summaryrefslogtreecommitdiff
path: root/lib/time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-03 11:31:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-03 11:31:33 +0000
commit4de238663a6e6d6b4f5306bb5f88a9e067c4f4c0 (patch)
tree42e904483f055e1ce400b26d8a26fe2111183274 /lib/time.rb
parent38656e24bea4a6ced1ebc18a0178bf8c1b175ca7 (diff)
* lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is not
given. Reported by tadayoshi funaba. [ruby-core:62322] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/time.rb')
-rw-r--r--lib/time.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/time.rb b/lib/time.rb
index e346a3e587..8ffd42dcd7 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -393,16 +393,16 @@ class Time
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
- if offset = d[:offset]
- Time.at(seconds).localtime(offset)
- else
- Time.at(seconds)
- end
+ t = Time.at(seconds)
else
year = d[:year]
year = yield(year) if year && block_given?
- make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
+ t = make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
+ end
+ if offset = d[:offset]
+ t.localtime(offset)
end
+ t
end
MonthValue = { # :nodoc: