summaryrefslogtreecommitdiff
path: root/main/sched.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-09-28 15:31:38 -0500
committerRichard Mudgett <rmudgett@digium.com>2015-09-30 10:47:12 -0500
commit9bc7386b7cdbb6d0b432deaa7329b532d78d949b (patch)
tree7486f31e3a155b9876283d5efd015e49d044efd2 /main/sched.c
parent12feec0bf7d40e2b3bce3601ffc2e034ad801a4d (diff)
sched.c: Add warning about negative time interval request.
Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc
Diffstat (limited to 'main/sched.c')
-rw-r--r--main/sched.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/sched.c b/main/sched.c
index 8f9e84bff..a7e670320 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -450,6 +450,17 @@ static int sched_settime(struct timeval *t, int when)
{
struct timeval now = ast_tvnow();
+ if (when < 0) {
+ /*
+ * A negative when value is likely a bug as it
+ * represents a VERY large timeout time.
+ */
+ ast_log(LOG_WARNING,
+ "Bug likely: Negative time interval %d (interpreted as %u ms) requested!\n",
+ when, (unsigned int) when);
+ ast_assert(0);
+ }
+
/*ast_debug(1, "TV -> %lu,%lu\n", tv->tv_sec, tv->tv_usec);*/
if (ast_tvzero(*t)) /* not supplied, default to now */
*t = now;