method
force_zone!
v2_4_6 -
Show latest stable
-
0 notes -
Class: Time
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
force_zone!(t, zone, offset=nil)
private
Hide source
# File lib/time.rb, line 179 def force_zone!(t, zone, offset=nil) if zone_utc?(zone) t.utc elsif offset ||= zone_offset(zone) # Prefer the local timezone over the fixed offset timezone because # the former is a real timezone and latter is an artificial timezone. t.localtime if t.utc_offset != offset # Use the fixed offset timezone only if the local timezone cannot # represent the given offset. t.localtime(offset) end else t.localtime end end