summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/time.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/time.rb b/lib/time.rb
index 4eb888aef6..26c083d309 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -280,9 +280,13 @@ class Time
def strptime(date, format, now=self.now)
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
- 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)
+ if seconds = d[:seconds]
+ 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)
+ end
end
MonthValue = {