-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate travel_offset to align with the precision of argument to Timecop.travel #421
Calculate travel_offset to align with the precision of argument to Timecop.travel #421
Conversation
7b8921f
to
5dcbc68
Compare
Subtracting two `Time`s returns a `Float`, which may not be accurate down to subsecond resolution. Because `Float`s are stored as double- precision values (IEEE 754), they can have resolutions much higher than the typical minimum clock precision of 10e-9 seconds. Which can result in two `Time` object not comparing as equal when they are the same down to the nanosecond, when one has had a travel_offset applied to it.
5dcbc68
to
2906ca3
Compare
2906ca3
to
c2bdfc7
Compare
@joshuacronemeyer I'd greatly appreciate your opinion on this PR, if you have the time. |
@joshuacronemeyer I still think this change has a significant benefit to users & would appreciate your opinions on it |
@dgholz thank you for your detailed issue and for this PR. I was spaced out i guess when this came in, so thanks for bringing it to my attention. I will try to look at this soon. |
Looks good! |
@dgholz I reverted this because of a failing test.
Happy to look at it again. |
Subtracting two
Time
s returns aFloat
, which may not be accurate down to subsecond resolution. BecauseFloat
s are stored as double-precision values (IEEE 754), they can have resolutions much higher than the typical minimum clock precision of 10e-9 seconds. Which can result in twoTime
object not comparing as equal when they are the same down to the nanosecond, when one has had atravel_offset
applied to it.To fix #420.