diff options
author | shtirlic <serg@podtynnyi.com> | 2011-07-11 18:41:04 +0400 |
---|---|---|
committer | shtirlic <serg@podtynnyi.com> | 2011-07-11 18:41:04 +0400 |
commit | c2b79c011f4ec39426c93812ab58660718c7cb92 (patch) | |
tree | 63e81f4f4565c95b2ebd9b8e7597abea16ba1ab9 /activesupport/lib | |
parent | 539d684b7a063555bd2d03a36b2e778217d94ae9 (diff) | |
download | rails-c2b79c011f4ec39426c93812ab58660718c7cb92.tar.gz rails-c2b79c011f4ec39426c93812ab58660718c7cb92.tar.bz2 rails-c2b79c011f4ec39426c93812ab58660718c7cb92.zip |
Fix xmlschema output with fraction_digits >0
Current implementation produce incorrect output when Time#usec returns
integer < 100000, because to_s doesn't add leading zeros.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 3d092529d6..ec2c717942 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -109,7 +109,7 @@ module ActiveSupport def xmlschema(fraction_digits = 0) fraction = if fraction_digits > 0 - ".%i" % time.usec.to_s[0, fraction_digits] + (".%06i" % time.usec)[0, fraction_digits + 1] end "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{fraction}#{formatted_offset(true, 'Z')}" |