mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix Time.parse to support nsec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a070c4fbe3
commit
81f0bb309e
1 changed files with 6 additions and 1 deletions
|
@ -150,7 +150,7 @@ class Time
|
|||
|
||||
def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
|
||||
usec = nil
|
||||
usec = (sec_fraction * 1000000).to_i if sec_fraction
|
||||
usec = sec_fraction * 1000000 if sec_fraction
|
||||
if now
|
||||
begin
|
||||
break if year; year = now.year
|
||||
|
@ -812,5 +812,10 @@ if __FILE__ == $0
|
|||
def test_strptime
|
||||
assert_equal(Time.utc(2005, 8, 28, 06, 54, 20), Time.strptime("28/Aug/2005:06:54:20 +0000", "%d/%b/%Y:%T %z"))
|
||||
end
|
||||
|
||||
def test_nsec
|
||||
assert_equal(123456789, Time.xmlschema("2000-01-01T00:00:00.123456789+00:00").tv_nsec)
|
||||
assert_equal(123456789, Time.parse("2000-01-01T00:00:00.123456789+00:00").tv_nsec)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue