diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-31 14:06:50 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-31 14:06:50 +0000 |
commit | 53293d3c627ac25ff2978859dabeaca14a6fe7b7 (patch) | |
tree | d5fe262d73e52897882aa0e5e53f6e03eb59e106 /lib | |
parent | 97a5506fd5b0559977944f6e907ae9bac3a21ca4 (diff) |
merge revision(s) 43177,43191: [Backport #8991]
* lib/time.rb (Time.strptime): Use :offset.
Patch by Felipe Contreras. [ruby-core:57694]
* 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/branches/ruby_1_9_3@43483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/time.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/time.rb b/lib/time.rb index 1663af8e76..40b28d9085 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -282,7 +282,11 @@ class Time d = Date._strptime(date, format) raise ArgumentError, "invalid strptime format - `#{format}'" unless d if seconds = d[:seconds] - Time.at(seconds) + 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? |