зеркало из https://github.com/github/ruby.git
* strftime.c (rb_strftime): The default precision should be 1, not
0. [ruby-dev:37155] * test/ruby/test_time.rb (test_strftime): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
1537855833
Коммит
32aed81046
|
@ -1,3 +1,10 @@
|
||||||
|
Mon Nov 24 21:38:23 2008 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* strftime.c (rb_strftime): The default precision should be 1, not
|
||||||
|
0. [ruby-dev:37155]
|
||||||
|
|
||||||
|
* test/ruby/test_time.rb (test_strftime): ditto.
|
||||||
|
|
||||||
Mon Nov 24 19:53:47 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
Mon Nov 24 19:53:47 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* lib/date.rb (inspect): changed again.
|
* lib/date.rb (inspect): changed again.
|
||||||
|
|
|
@ -405,7 +405,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
||||||
|
|
||||||
case 'w': /* weekday, Sunday == 0, 0 - 6 */
|
case 'w': /* weekday, Sunday == 0, 0 - 6 */
|
||||||
i = range(0, timeptr->tm_wday, 6);
|
i = range(0, timeptr->tm_wday, 6);
|
||||||
FMT('0', 0, "d", i);
|
FMT('0', 1, "d", i);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 'W': /* week of year, Monday is first day of week */
|
case 'W': /* week of year, Monday is first day of week */
|
||||||
|
@ -426,7 +426,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 'Y': /* year with century */
|
case 'Y': /* year with century */
|
||||||
FMT('0', 0, "ld", 1900L + timeptr->tm_year);
|
FMT('0', 1, "ld", 1900L + timeptr->tm_year);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef MAILHEADER_EXT
|
#ifdef MAILHEADER_EXT
|
||||||
|
@ -623,7 +623,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
/* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */
|
/* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */
|
||||||
FMT('0', 0, "d", timeptr->tm_wday == 0 ? 7 : timeptr->tm_wday);
|
FMT('0', 1, "d", timeptr->tm_wday == 0 ? 7 : timeptr->tm_wday);
|
||||||
continue;
|
continue;
|
||||||
#endif /* POSIX2_DATE */
|
#endif /* POSIX2_DATE */
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
|
||||||
y = 1900L + timeptr->tm_year;
|
y = 1900L + timeptr->tm_year;
|
||||||
|
|
||||||
if (*format == 'G')
|
if (*format == 'G')
|
||||||
FMT('0', 0, "ld", y);
|
FMT('0', 1, "ld", y);
|
||||||
else
|
else
|
||||||
FMT('0', 2, "ld", y % 100);
|
FMT('0', 2, "ld", y % 100);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -444,5 +444,10 @@ class TestTime < Test::Unit::TestCase
|
||||||
assert_equal(" 2", t.strftime("%l"))
|
assert_equal(" 2", t.strftime("%l"))
|
||||||
assert_equal("02", t.strftime("%0l"))
|
assert_equal("02", t.strftime("%0l"))
|
||||||
assert_equal(" 2", t.strftime("%_l"))
|
assert_equal(" 2", t.strftime("%_l"))
|
||||||
|
|
||||||
|
# [ruby-dev:37155]
|
||||||
|
t = Time.mktime(1970, 1, 18)
|
||||||
|
assert_equal("0", t.strftime("%w"))
|
||||||
|
assert_equal("7", t.strftime("%u"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче