[Asterisk-cvs] asterisk channel.c,1.159,1.160

markster at lists.digium.com markster at lists.digium.com
Wed Jan 5 16:24:33 CST 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv20668

Modified Files:
	channel.c 
Log Message:
Calculate tvdiff properly (avoid off-by-one)


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- channel.c	4 Jan 2005 04:01:40 -0000	1.159
+++ channel.c	5 Jan 2005 22:29:30 -0000	1.160
@@ -2546,7 +2546,11 @@
 
 static long tvdiff(struct timeval *now, struct timeval *then) 
 {
+#if 0
 	return (((now->tv_sec * 1000) + now->tv_usec / 1000) - ((then->tv_sec * 1000) + then->tv_usec / 1000));
+#else
+	return (now->tv_sec - then->tv_sec) * 1000 + (now->tv_usec - then->tv_usec) / 1000;	
+#endif
 }
 
 struct ast_channel *ast_bridged_channel(struct ast_channel *chan)




More information about the svn-commits mailing list