commit e1b69a5650a1154d55412487a40d6ad1ff022ba4 Author: FURUHASHI Sadayuki Date: Tue Feb 24 21:50:12 2015 -0800 time.rb: Time.strptime with %s.%N format should not ignore sec_fraction diff --git a/lib/time.rb b/lib/time.rb index 8edc9e6..826ffc7 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -426,7 +426,9 @@ class Time d = Date._strptime(date, format) raise ArgumentError, "invalid strptime format - `#{format}'" unless d if seconds = d[:seconds] - t = Time.at(seconds) + sec_fraction = d[:sec_fraction] + usec = sec_fraction ? sec_fraction * 1000000 : 0 + t = Time.at(seconds, usec) if zone = d[:zone] force_zone!(t, zone) end