[Asterisk-cvs] zaptel ztmonitor.c,1.7,1.8

markster at lists.digium.com markster at lists.digium.com
Mon Feb 23 15:34:38 CST 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv22650

Modified Files:
	ztmonitor.c 
Log Message:
Prevent integer overflow on timeout


Index: ztmonitor.c
===================================================================
RCS file: /usr/cvsroot/zaptel/ztmonitor.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ztmonitor.c	28 Jan 2004 23:32:54 -0000	1.7
+++ ztmonitor.c	23 Feb 2004 20:22:57 -0000	1.8
@@ -194,12 +194,12 @@
 	static int samerxmax = 0;
 	static int txbest = 0;
 	static int rxbest = 0;
-	int ms;
+	float ms;
 	static struct timeval last;
 	struct timeval tv;
 	
 	gettimeofday(&tv, NULL);
-	ms = (tv.tv_sec - last.tv_sec) * 1000 + (tv.tv_usec - last.tv_usec) / 1000;
+	ms = (tv.tv_sec - last.tv_sec) * 1000.0 + (tv.tv_usec - last.tv_usec) / 1000.0;
 	for (x=0;x<cnt;x++) {
 		txavg += abs(tx[x]);
 		rxavg += abs(rx[x]);




More information about the svn-commits mailing list