diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-07 21:00:12 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-07 21:00:12 +0000 |
commit | a8178c69bee18250aa022bb270390279487a8618 (patch) | |
tree | 1f1d6cf8f9e256110d1305cf5e16467f12b16cfa /lib/time.rb | |
parent | 9410e7e00ca1c43619ad202595b668358cf1c389 (diff) |
* lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
time Time object as Ruby 2.0 and before.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/time.rb')
-rw-r--r-- | lib/time.rb | 7 |
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? |