ruby-changes:2478
From: ko1@a...
Date: 19 Nov 2007 18:24:41 +0900
Subject: [ruby-changes:2478] akr - Ruby:r13969 (trunk): fix Time.parse to support nsec.
akr 2007-11-19 18:24:28 +0900 (Mon, 19 Nov 2007) New Revision: 13969 Modified files: trunk/lib/time.rb Log: fix Time.parse to support nsec. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/time.rb?r1=13969&r2=13968 Index: lib/time.rb =================================================================== --- lib/time.rb (revision 13968) +++ lib/time.rb (revision 13969) @@ -150,7 +150,7 @@ 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml