1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #26359 from maclover7/jm-speed-up-time

Speed up Time.zone.now
This commit is contained in:
Matthew Draper 2016-10-06 02:35:35 +10:30 committed by GitHub
commit 0464b728e2

View file

@ -477,6 +477,8 @@ module ActiveSupport
end
def transfer_time_values_to_utc_constructor(time)
# avoid creating another Time object if possible
return time if time.instance_of?(::Time) && time.utc?
::Time.utc(time.year, time.month, time.day, time.hour, time.min, time.sec + time.subsec)
end