Skip to content
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

Accuracy #19

Open
igneus opened this issue Jun 13, 2016 · 0 comments
Open

Accuracy #19

igneus opened this issue Jun 13, 2016 · 0 comments

Comments

@igneus
Copy link

igneus commented Jun 13, 2016

Recently I was debugging code which relied on TimeDifference when computing difference in days between two Dates. It turned out that code like

TimeDifference.between(
  Date.new(2015, 3, 15), 
  Date.new(2015, 4, 14)
).in_days.to_i

returns on different platforms different results. Having read how TimeDifference makes the calculations (dividing difference in seconds by an approximate length of a year / month / day / ... in seconds) I'm not surprised any more by the results, but for the sake of others tempted to make the same mistake I suggest being more explicit in the README concerning accuracy: TimeDifference is great for quick calculations where no accuracy is required (how long is it since I wrote my blog post?), but unsuitable for accurate computations (for how many days of using the service will I be billed?).

@igneus igneus changed the title Precision Accuracy Jun 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant