diff options
author | Gordon Chan <developer.gordon+github@gmail.com> | 2014-05-30 20:29:30 +1200 |
---|---|---|
committer | Gordon Chan <developer.gordon+github@gmail.com> | 2014-05-30 20:41:39 +1200 |
commit | c69baffdf752e2255fe1efc80ce32017bb1896e7 (patch) | |
tree | acf37a7ea044c9513fbe9b12b2d5c1e8b9a437ca /activerecord/test/migrations/decimal | |
parent | 6963e33829c11f7036b8c8015e2c5222a469c118 (diff) | |
download | rails-c69baffdf752e2255fe1efc80ce32017bb1896e7.tar.gz rails-c69baffdf752e2255fe1efc80ce32017bb1896e7.tar.bz2 rails-c69baffdf752e2255fe1efc80ce32017bb1896e7.zip |
Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
When working with objects with a nanosecond component, the `-` method may
unnecessarily cause loss of precision.
`ActiveSupport::TimeWithZone#-` should return the same result as if we were
using `Time#-`:
Time.now.end_of_day - Time.now.beginning_of_day #=> 86399.999999999
Before:
Time.zone.now.end_of_day.nsec #=> 999999999
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day #=> 86400.0
After:
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day
#=> 86399.999999999
Diffstat (limited to 'activerecord/test/migrations/decimal')
0 files changed, 0 insertions, 0 deletions