cvs: /php4/ext/standard microtime.c
| From: | Sascha Schumann | Date: | Tue, 21 Sep 1999 08:22:33 +0000 |
| Subject: | cvs: /php4/ext/standard microtime.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4732@lists.php.net to get a copy of this message | ||
sas Tue Sep 21 04:22:33 1999 EDT
Modified files:
/php4/ext/standard microtime.c
Log:
On at least Win32, gettimeofday() returns values in tv_usec which exceed
1,000,000.
For portability reasons we set the integer part of our result to 0.
This is equivalent to using tv_usec % 1000000.
Index: php4/ext/standard/microtime.c
diff -u php4/ext/standard/microtime.c:1.7 php4/ext/standard/microtime.c:1.8
--- php4/ext/standard/microtime.c:1.7 Fri Jul 16 09:12:56 1999
+++ php4/ext/standard/microtime.c Tue Sep 21 04:22:33 1999
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.c,v 1.7 1999/07/16 13:12:56 zeev Exp $ */
+/* $Id: microtime.c,v 1.8 1999/09/21 08:22:33 sas Exp $ */
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
@@ -55,6 +55,7 @@
msec = (double) (tp.tv_usec / MICRO_IN_SEC);
sec = tp.tv_sec;
}
+ if (msec > 1.0) msec -= (long) msec;
snprintf(ret, 100, "%.8f %ld", msec, sec);
RETVAL_STRING(ret,1);
#endif