aboutsummaryrefslogtreecommitdiffstats
path: root/main/cdr.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-07 16:33:02 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-07 16:33:02 +0000
commitf944addb40a6ee76baef5cd0d4bd5390f44c0bc2 (patch)
tree38ac2841a2b346370dee91eba045dc628b2472bb /main/cdr.c
parent029f6738e4caba6d1842058db209b313d0be6484 (diff)
Merged revisions 42260 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r42260 | file | 2006-09-07 12:30:44 -0400 (Thu, 07 Sep 2006) | 2 lines Let's use the same thing we use in other places to calculate our time for ast_cond_timedwait (issue #7697 reported by bn999) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@42261 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 04d7ea833..19163cff6 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -945,13 +945,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);