summaryrefslogtreecommitdiff
path: root/ext/standard/microtime.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-09-21 08:22:33 +0000
committerSascha Schumann <sas@php.net>1999-09-21 08:22:33 +0000
commitcf00d75980d12cc2758b04efe09e970b4d9d4285 (patch)
tree4e46738c833dd3cf3ae42f004dbda3464f3ff1eb /ext/standard/microtime.c
parent8b1195ffccd5ba25e3940ecbb21516152a94abb8 (diff)
downloadphp-git-cf00d75980d12cc2758b04efe09e970b4d9d4285.tar.gz
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.
Diffstat (limited to 'ext/standard/microtime.c')
-rw-r--r--ext/standard/microtime.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 0ab88704ac..22bb8c7715 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -55,6 +55,7 @@ PHP_FUNCTION(microtime)
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