From a2616db4dc810aa44d90d768a627c62d2a67886c Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Mon, 13 May 2019 19:46:26 +0900 Subject: Fix `Time#(asctime|ctime)` according to ISO Ruby - A leading charactor for day is space. - Time zone does not included. Before this patch: Time.gm(1982,3,4,5,6,7).asctime #=> "Thu Mar 04 05:06:07 UTC 1982" After this patch: Time.gm(1982,3,4,5,6,7).asctime #=> "Thu Mar 4 05:06:07 1982" --- mrbgems/mruby-time/src/time.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mrbgems/mruby-time/src') diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 7f6c3004d..bc8abc7ae 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -576,10 +576,9 @@ mrb_time_asctime(mrb_state *mrb, mrb_value self) #else char buf[256]; - len = snprintf(buf, sizeof(buf), "%s %s %02d %02d:%02d:%02d %s%d", + len = snprintf(buf, sizeof(buf), "%s %s %2d %02d:%02d:%02d %.4d", wday_names[d->tm_wday], mon_names[d->tm_mon], d->tm_mday, d->tm_hour, d->tm_min, d->tm_sec, - tm->timezone == MRB_TIMEZONE_UTC ? "UTC " : "", d->tm_year + 1900); #endif return mrb_str_new(mrb, buf, len); -- cgit v1.2.3