зеркало из https://github.com/github/ruby.git
* lib/time.rb (xmlschema): avoid passing any negative numbers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
1348dd26b0
Коммит
0999333732
|
@ -1,3 +1,7 @@
|
|||
Sun May 8 19:04:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* lib/time.rb (xmlschema): avoid passing any negative numbers.
|
||||
|
||||
Sun May 8 18:40:03 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* ext/date/date_{parse,strptime}.c: introduced some macros.
|
||||
|
|
|
@ -519,7 +519,7 @@ class Time
|
|||
def xmlschema(fraction_digits=0)
|
||||
sprintf('%0*d-%02d-%02dT%02d:%02d:%02d',
|
||||
year < 0 ? 5 : 4, year, mon, day, hour, min, sec) +
|
||||
if fraction_digits == 0
|
||||
if fraction_digits <= 0
|
||||
''
|
||||
else
|
||||
'.' + sprintf('%0*d', fraction_digits, (subsec * 10**fraction_digits).floor)
|
||||
|
|
Загрузка…
Ссылка в новой задаче