diff options
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/strftime.c b/strftime.c index addfe6b862..6ad74de085 100644 --- a/strftime.c +++ b/strftime.c @@ -496,7 +496,13 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm, continue; case 'Y': /* year with century */ - FMTV('0', 1, "d", vtm->year); + if (FIXNUM_P(vtm->year)) { + long y = FIX2LONG(vtm->year); + FMT('0', 0 <= y ? 4 : 5, "ld", y); + } + else { + FMTV('0', 4, "d", vtm->year); + } continue; #ifdef MAILHEADER_EXT |