Browse Source

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.
experimetnal/RETURN_REF_PATCH
Sascha Schumann 27 years ago
parent
commit
cf00d75980
  1. 1
      ext/standard/microtime.c

1
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

Loading…
Cancel
Save