diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | lib/time.rb | 5 |
3 files changed, 12 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Sun May 4 20:51:32 2014 Tanaka Akira <akr@fsij.org> + + * lib/time.rb (Time.force_zone!): Use usual local time if it has + expected offset from UTC. + Sun May 4 17:58:12 2014 Tanaka Akira <akr@fsij.org> * lib/time.rb (Time.force_zone!): New private method. @@ -73,8 +73,9 @@ with all sufficient information, see the ChangeLog file. === Stdlib compatibility issues (excluding feature bug fixes) * time.rb - * Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema produces - fixed-offset Time objects to preserve the offset from UTC. + * Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema may produce + fixed-offset Time objects. + It is happen when usual localtime doesn't preserve the offset from UTC. * Time.httpdate produces always UTC Time object. === Built-in global variables compatibility issues diff --git a/lib/time.rb b/lib/time.rb index e394078a03..f080718dff 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -178,7 +178,10 @@ class Time if zone_utc?(zone) t.utc elsif offset ||= zone_offset(zone) - t.localtime(offset) + t.localtime + if t.utc_offset != offset + t.localtime(offset) + end else t.localtime end |