keithw/mosh — pull request #511 by andersk (2014-04-18 09:58:22+00:00)
Title: 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.