diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-05-13 19:46:26 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-05-13 19:46:26 +0900 |
| commit | a2616db4dc810aa44d90d768a627c62d2a67886c (patch) | |
| tree | 994618c9eb3adb3da20ecb464da05796756e0f28 /mrbgems/mruby-time/src | |
| parent | b145ed9de55019201bd3553660241ce3cc3c36de (diff) | |
| download | mruby-a2616db4dc810aa44d90d768a627c62d2a67886c.tar.gz mruby-a2616db4dc810aa44d90d768a627c62d2a67886c.zip | |
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"
Diffstat (limited to 'mrbgems/mruby-time/src')
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 3 |
1 files changed, 1 insertions, 2 deletions
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); |
