diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-29 08:28:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-29 08:28:04 +0000 |
commit | 60683816be0674fc3e0a07855f5c2de68c4db771 (patch) | |
tree | e314f18ee8e59773b733edd357df6b32bf51caca /strftime.c | |
parent | 4f4de9b858a3336e065b31dd7fa338d02a8a29eb (diff) |
strftime.c: fix colon modifier.
partially borrowed from ext/date.
* strftime.c (rb_strftime_with_timespec): colons are valid only for
'z' and must come just before it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/strftime.c b/strftime.c index ba65c87502..767a852727 100644 --- a/strftime.c +++ b/strftime.c @@ -758,8 +758,12 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encodi goto again; case ':': - FLAG_FOUND(); - colons++; + { + size_t l = strspn(format, ":"); + if (l > 3 || format[l] != 'z') goto unknown; + colons = (int)l; + format += l - 1; + } goto again; case '0': |