* lib/time.rb (strptime): Support %s.%N.

[ruby-core:68301] [Bug #10904] Patch by Sadayuki Furuhashi.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2015-03-01 00:12:48 +00:00
parent fe6cf485e6
commit 9ee9812dad
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Sun Mar 1 09:06:11 2015 Tanaka Akira <akr@fsij.org>
* lib/time.rb (strptime): Support %s.%N.
[ruby-core:68301] [Bug #10904] Patch by Sadayuki Furuhashi.
Sat Feb 28 17:18:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enum.c (enum_each_slice, enum_each_cons): limit elements size by

View File

@ -426,7 +426,13 @@ class Time
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
t = Time.at(seconds)
if sec_fraction = d[:sec_fraction]
usec = sec_fraction * 1000000
usec *= -1 if seconds < 0
else
usec = 0
end
t = Time.at(seconds, usec)
if zone = d[:zone]
force_zone!(t, zone)
end