[Issue 15334] New: OS X core.time ticksPerSecond calculation is incorrect
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Nov 13 23:47:52 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15334
Issue ID: 15334
Summary: OS X core.time ticksPerSecond calculation is incorrect
Product: D
Version: D2
Hardware: All
OS: Mac OS X
Status: NEW
Severity: regression
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: gorox at comcast.net
The _d_initMonoTime() version(OSX) calculation for ticksPerSecond is using a
flipped mach_timebase_info ratio numer/denom when it should be denom/numer.
Fortunately (or unfortunately depending on your point of view) it doesn't show
up as a problem on Intel OS X Macs because numer and denom are both 1.
On an iOS iPhone, wrong results would be produced because numer = 125 and denom
= 3.
The wrong calculation shows up here:
https://github.com/D-Programming-Language/druntime/blob/master/src/core/time.d#L2639
This is a regression because the correct calculation shows up in the deprecated
struct TickDuration here:
https://github.com/D-Programming-Language/druntime/blob/master/src/core/time.d#L2954
--
More information about the Digitalmars-d-bugs
mailing list