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:
commit
0464b728e2
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue