diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-05 15:08:12 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-05 15:08:12 +0000 |
commit | f1296598a2097e1e355307e16752b549f0f6b24c (patch) | |
tree | 88326ea5c0e07edea330a9f023dc4bf0831abb6b | |
parent | 00aae60f73bd800d2789501a732cb6ab7c44e528 (diff) | |
download | ruby-f1296598a2097e1e355307e16752b549f0f6b24c.tar.gz |
* lib/time.rb (Time.xmlschema): don't use float. fix
http://rubyforge.org/tracker/index.php?func=detail&group_id=426&atid=1698&aid=20504
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/time.rb | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Fri Jun 6 00:05:33 2008 Tanaka Akira <akr@fsij.org> + + * lib/time.rb (Time.xmlschema): don't use float. fix + http://rubyforge.org/tracker/index.php?func=detail&group_id=426&atid=1698&aid=20504 + Thu Jun 5 23:56:18 2008 Yusuke Endoh <mame@tsg.ne.jp> * test/ruby/test_gc.rb: add tests to achieve over 90% test coverage of diff --git a/lib/time.rb b/lib/time.rb index b306d0a452..49c07c6214 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -384,7 +384,9 @@ class Time min = $5.to_i sec = $6.to_i usec = 0 - usec = $7.to_f * 1000000 if $7 + if $7 + usec = Rational(($7[1..-1] + '000000000')[0,9].to_i, 1000) + end if $8 zone = $8 year, mon, day, hour, min, sec = @@ -645,6 +647,8 @@ if __FILE__ == $0 t = Time.utc(1960, 12, 31, 23, 0, 0, 123456) assert_equal("1960-12-31T23:00:00.123456Z", t.xmlschema(6)) end + + assert_equal(249, Time.xmlschema("2008-06-05T23:49:23.000249+09:00").usec) end def test_completion |