diff options
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/strftime.c b/strftime.c index 7913c792a5..e2c8d5fabd 100644 --- a/strftime.c +++ b/strftime.c @@ -295,7 +295,12 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept do { \ i = strftime(s, endp - s, fmt, tm); \ if (!i) return 0; \ - s += i; \ + if (precision > i) {\ + memmove(s + precision - i, s, i);\ + memset(s, padding ? padding : ' ', precision - i); \ + s += precision; \ + }\ + else s += i; \ } while (0) if (*format != '%') { |