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
@ -150,7 +150,7 @@ class Time
|
|||||||
|
|
||||||
def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
|
def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
|
||||||
usec = nil
|
usec = nil
|
||||||
usec = (sec_fraction * 1000000).to_i if sec_fraction
|
usec = sec_fraction * 1000000 if sec_fraction
|
||||||
if now
|
if now
|
||||||
begin
|
begin
|
||||||
break if year; year = now.year
|
break if year; year = now.year
|
||||||
@ -812,5 +812,10 @@ if __FILE__ == $0
|
|||||||
def test_strptime
|
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"))
|
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
|
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
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user