aboutsummaryrefslogtreecommitdiffstats
path: root/cdr.c
diff options
context:
space:
mode:
authorroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-07 17:03:13 +0000
committerroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-07 17:03:13 +0000
commit0dc5240868da6abae79d839e3cfa890233ce251f (patch)
treef653e6472534ba5a98ed7dd6fd0cd1966037d8e2 /cdr.c
parent5e01b9461a16f899d2a22bf807479d42e8829ed7 (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@42282 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr.c')
-rw-r--r--cdr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cdr.c b/cdr.c
index 272ce0f69..64a9e5690 100644
--- a/cdr.c
+++ b/cdr.c
@@ -1044,13 +1044,14 @@ static void *do_cdr(void *data)
int numevents = 0;
for(;;) {
- struct timeval now = ast_tvnow();
+ struct timeval now;
schedms = ast_sched_wait(sched);
/* this shouldn't happen, but provide a 1 second default just in case */
if (schedms <= 0)
schedms = 1000;
- timeout.tv_sec = now.tv_sec + (schedms / 1000);
- timeout.tv_nsec = (now.tv_usec * 1000) + ((schedms % 1000) * 1000);
+ now = ast_tvadd(ast_tvnow(), ast_samp2tv(schedms, 1000));
+ timeout.tv_sec = now.tv_sec;
+ timeout.tv_nsec = now.tv_usec * 1000;
/* prevent stuff from clobbering cdr_pending_cond, then wait on signals sent to it until the timeout expires */
ast_mutex_lock(&cdr_pending_lock);
ast_cond_timedwait(&cdr_pending_cond, &cdr_pending_lock, &timeout);