[asterisk-commits] file: branch 1.2 r42260 - /branches/1.2/cdr.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 7 09:30:44 MST 2006


Author: file
Date: Thu Sep  7 11:30:44 2006
New Revision: 42260

URL: http://svn.digium.com/view/asterisk?rev=42260&view=rev
Log:
Let's use the same thing we use in other places to calculate our time for ast_cond_timedwait (issue #7697 reported by bn999)

Modified:
    branches/1.2/cdr.c

Modified: branches/1.2/cdr.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/cdr.c?rev=42260&r1=42259&r2=42260&view=diff
==============================================================================
--- branches/1.2/cdr.c (original)
+++ branches/1.2/cdr.c Thu Sep  7 11:30:44 2006
@@ -1044,13 +1044,14 @@
 	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);



More information about the asterisk-commits mailing list