Commit Graph

3 Commits

Author SHA1 Message Date
Anders Kaseorg e52d22b6da Timestamp: Prevent integer overflow on Darwin PPC 32-bit
A Darwin PPC 32-bit user observes huge values numer == 1000000000 and
denom == 18431683 returned from mach_timebase_info().  For these
values, mach_absolute_time() * numer overflows uint64_t every 1000.82
seconds, and 1000000 * denom always overflows uint32_t, with the
effect of making time run backwards at -11190660 times its usual
speed.

This bug was masked on Darwin x86 64-bit, where numer == denom == 1.

Fix it by doing the conversion with double arithmetic instead.

Closes #479.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-05-25 02:14:53 -04:00
Keith Winstein e9c4184c27 Fix compilation bug when clock_gettime missing 2013-01-14 22:25:03 -05:00
Keith Winstein a744004bf6 Get system timestamp less often (only after sleeping/selecting) 2012-07-26 21:13:26 -04:00