summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/timer.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-03-01 19:27:06 +0000
committerBenny Prijono <bennylp@teluu.com>2006-03-01 19:27:06 +0000
commite067eb31fc0161c34c1af1595415bfeeccd29789 (patch)
treed891625c9e3b19fea63f4baaa7f265dbc57510cd /pjlib/src/pj/timer.c
parentd87fe4de7a50f62dfcac41031498e758dd8fbaf1 (diff)
Fixed bug in timer, where poll() can return negative time, causing havoc with other polling function that depends on the value
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@251 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/timer.c')
-rw-r--r--pjlib/src/pj/timer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pjlib/src/pj/timer.c b/pjlib/src/pj/timer.c
index 2a791b63..6f7a2216 100644
--- a/pjlib/src/pj/timer.c
+++ b/pjlib/src/pj/timer.c
@@ -505,6 +505,8 @@ PJ_DEF(unsigned) pj_timer_heap_poll( pj_timer_heap_t *ht,
if (ht->cur_size && next_delay) {
*next_delay = ht->heap[0]->_timer_value;
PJ_TIME_VAL_SUB(*next_delay, now);
+ if (next_delay->sec < 0 || next_delay->msec < 0)
+ next_delay->sec = next_delay->msec = 0;
} else if (next_delay) {
next_delay->sec = next_delay->msec = PJ_MAXINT32;
}