Skip to content

Commit

Permalink
Dup the Time object before calling Time#localtime or Time#utc
Browse files Browse the repository at this point in the history
Closes #250.
Closes #252.
  • Loading branch information
sferik committed Jan 13, 2015
1 parent d3b7b9a commit 7c8b497
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/t.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module T
class << self
# Convert time to local time by applying the `utc_offset` setting.
def local_time(time)
utc_offset ? (time.dup.utc + utc_offset) : time.localtime
time = time.dup
utc_offset ? (time.utc + utc_offset) : time.localtime
end

# UTC offset in seconds to apply time instances before displaying.
Expand Down

0 comments on commit 7c8b497

Please sign in to comment.