diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-01-11 13:02:34 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-01-11 13:02:44 -0800 |
commit | 6fe739ad752aeeaaf274ced6111685d2d6ed2eb8 (patch) | |
tree | 59e6f9d8df82c8cbc8397a321df014013082e2a6 /activesupport/lib/active_support/time_with_zone.rb | |
parent | e8980ad278923e07eb1626908f40608db7f7a6ff (diff) | |
parent | 296ca4da1700eb27a7043112d22027444ea0e548 (diff) | |
download | rails-6fe739ad752aeeaaf274ced6111685d2d6ed2eb8.tar.gz rails-6fe739ad752aeeaaf274ced6111685d2d6ed2eb8.tar.bz2 rails-6fe739ad752aeeaaf274ced6111685d2d6ed2eb8.zip |
Sync 'rails/rails/master'
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 51939e1d01..82b47b6c47 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -99,8 +99,12 @@ module ActiveSupport "#{time.strftime('%a, %d %b %Y %H:%M:%S')} #{zone} #{formatted_offset}" end - def xmlschema - "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, 'Z')}" + def xmlschema(fraction_digits = 0) + fraction = if fraction_digits > 0 + ".%i" % time.usec.to_s[0, fraction_digits] + end + + "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{fraction}#{formatted_offset(true, 'Z')}" end alias_method :iso8601, :xmlschema |