D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15334 - [REG 2.069] OS X core.time ticksPerSecond calculation is incorrect
Summary: [REG 2.069] OS X core.time ticksPerSecond calculation is incorrect
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All Mac OS X
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-14 07:47 UTC by Dan Olson
Modified: 2018-01-05 13:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dan Olson 2015-11-14 07:47:52 UTC
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
Comment 1 Steven Schveighoffer 2015-11-16 13:58:50 UTC
PR https://github.com/D-Programming-Language/druntime/pull/1432
Comment 2 github-bugzilla 2015-11-16 18:20:26 UTC
Commit pushed to stable at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/fdad9f502dc3a5cac0bac0cfa7d55fc4b7c273b5
Merge pull request #1432 from smolt/ticksPerSecOSXFixStable

Fix issue 15334 - OS X core.time ticksPerSecond calculation is incorrect
Comment 3 github-bugzilla 2016-02-28 19:04:42 UTC
Commit pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/fdad9f502dc3a5cac0bac0cfa7d55fc4b7c273b5
Merge pull request #1432 from smolt/ticksPerSecOSXFixStable
Comment 4 github-bugzilla 2018-01-05 13:26:59 UTC
Commit pushed to dmd-cxx at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/fdad9f502dc3a5cac0bac0cfa7d55fc4b7c273b5
Merge pull request #1432 from smolt/ticksPerSecOSXFixStable