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

* lib/time.rb (Time.force_zone!): Use usual local time if it has

expected offset from UTC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-05-04 11:52:26 +00:00
parent a18177d5ed
commit fffbcf2867
3 changed files with 12 additions and 3 deletions

View file

@ -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> Sun May 4 17:58:12 2014 Tanaka Akira <akr@fsij.org>
* lib/time.rb (Time.force_zone!): New private method. * lib/time.rb (Time.force_zone!): New private method.

5
NEWS
View file

@ -73,8 +73,9 @@ with all sufficient information, see the ChangeLog file.
=== Stdlib compatibility issues (excluding feature bug fixes) === Stdlib compatibility issues (excluding feature bug fixes)
* time.rb * time.rb
* Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema produces * Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema may produce
fixed-offset Time objects to preserve the offset from UTC. fixed-offset Time objects.
It is happen when usual localtime doesn't preserve the offset from UTC.
* Time.httpdate produces always UTC Time object. * Time.httpdate produces always UTC Time object.
=== Built-in global variables compatibility issues === Built-in global variables compatibility issues

View file

@ -178,7 +178,10 @@ class Time
if zone_utc?(zone) if zone_utc?(zone)
t.utc t.utc
elsif offset ||= zone_offset(zone) elsif offset ||= zone_offset(zone)
t.localtime(offset) t.localtime
if t.utc_offset != offset
t.localtime(offset)
end
else else
t.localtime t.localtime
end end