diff options
author | sonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-19 04:20:48 +0000 |
---|---|---|
committer | sonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-19 04:20:48 +0000 |
commit | 64231b49ca957b2a6810673e1f2abc3f63d11f29 (patch) | |
tree | f952cbf80e63596f5fe3d10e53b78c4893c0f33e /lib/time.rb | |
parent | b48c212ec9c72a80a2d40aa5db8df65a88c8d73c (diff) | |
download | ruby-64231b49ca957b2a6810673e1f2abc3f63d11f29.tar.gz |
* lib/time.rb: revert r54167 because it would break
backward compatibilities, and it is documented that
Time.parse does not take into account time zone
abbreations other than ones described in RFC 822
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/time.rb')
-rw-r--r-- | lib/time.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/time.rb b/lib/time.rb index 61e973a461..69e524fd61 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -249,18 +249,14 @@ class Time end private :apply_offset - def make_time(date, year, mon, day, hour, min, sec, sec_fraction, zone, offset, now) + def make_time(date, year, mon, day, hour, min, sec, sec_fraction, zone, now) if !year && !mon && !day && !hour && !min && !sec && !sec_fraction raise ArgumentError, "no time information in #{date.inspect}" end + off_year = year || now.year off = nil - if offset - off = offset - else - off_year = year || now.year - off = zone_offset(zone, off_year) if zone - end + off = zone_offset(zone, off_year) if zone if off now = now.getlocal(off) if now.utc_offset != off @@ -291,10 +287,8 @@ class Time sec ||= 0 usec ||= 0 - off = nil - if offset - off = offset - elsif year != off_year + if year != off_year + off = nil off = zone_offset(zone, year) if zone end @@ -369,7 +363,7 @@ class Time d = Date._parse(date, comp) year = d[:year] year = yield(year) if year && !comp - make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], d[:offset], now) + make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now) end # @@ -447,7 +441,7 @@ class Time else year = d[:year] year = yield(year) if year && block_given? - t = make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], d[:offset], now) + t = make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now) end t end |