From 50f0052f18a2d30f6d97dde920d0f3009d2c2c16 Mon Sep 17 00:00:00 2001 From: David Grayson Date: Mon, 21 Jan 2013 12:10:12 -0800 Subject: [PATCH] xsd/datatypes.rb: Fixed a bug that was causing this gem to generate invalid date strings like '2013-01-18T15:37:1645505.8806112000020221-08:00'. The DateTime#sec_fraction method has units of seconds in Ruby 1.9.3, not days. I am assuming we don't care about this gem working with Ruby 1.8. --- lib/xsd/datatypes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/xsd/datatypes.rb b/lib/xsd/datatypes.rb index 0e9669c..61060ac 100644 --- a/lib/xsd/datatypes.rb +++ b/lib/xsd/datatypes.rb @@ -655,7 +655,7 @@ def _to_s s << ".#{ @secfrac }" else s << sprintf("%.16f", - (@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '') + @data.sec_fraction.to_f).sub(/^0/, '').sub(/0*$/, '') end end add_tz(s) @@ -705,7 +705,7 @@ def _to_s s << ".#{ @secfrac }" else s << sprintf("%.16f", - (@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '') + @data.sec_fraction.to_f).sub(/^0/, '').sub(/0*$/, '') end end add_tz(s)