aboutsummaryrefslogtreecommitdiffstats
path: root/lib/time.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/time.rb')
-rw-r--r--lib/time.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/time.rb b/lib/time.rb
index 2b3ebd1b40..0b55480334 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -393,8 +393,11 @@ class Time
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
- offset = d[:offset] || 0
- Time.at(seconds).localtime(offset)
+ if offset = d[:offset]
+ Time.at(seconds).localtime(offset)
+ else
+ Time.at(seconds)
+ end
else
year = d[:year]
year = yield(year) if year && block_given?