-
Notifications
You must be signed in to change notification settings - Fork 563
Closed
Labels
Description
We discovered this in v4.2.18.
When quoted, times with microseconds in the range 999500..999999 are rounded down to the next full second (effectively the microseconds are removed) instead of rounded up.
irb(main):154:0> ApplicationRecord.connection.class
=> ActiveRecord::ConnectionAdapters::SQLServerAdapter
irb(main):155:0> ApplicationRecord.connection.class.const_get('VERSION')
=> "4.2.18"
irb(main):156:0> ApplicationRecord.connection.quote('2017-11-25 10:05:38.999499'.to_time)
=> "'11-25-2017 09:05:38.999'"
irb(main):157:0> ApplicationRecord.connection.quote('2017-11-25 10:05:38.999500'.to_time)
=> "'11-25-2017 09:05:38'"
irb(main):158:0> ApplicationRecord.connection.quote('2017-11-25 10:05:38.999999'.to_time)
=> "'11-25-2017 09:05:38'"
I expect '11-25-2017 09:05:39' in the last two examples (or at least '11-25-2017 09:05:38.999'; that's what v5.0.7 seems to do).