diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-30 09:22:13 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-30 09:22:13 +0000 |
commit | 303d9d972abfd73e5738d3e7eeb142b9689f0eb6 (patch) | |
tree | ba366a3cd65dae5edd10b70ec7136436bf712cca /strftime.c | |
parent | b2bfcf403c2d3d379061f6ea115cb889f5a90de8 (diff) |
merges r20342 from trunk to ruby_1_9_1.
* strftime.c (rb_strftime): The # flag should work with %a, %A, %b,
%B, and %h. [ruby-dev:37162]
* test/ruby/test_time.rb (test_strftime): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/strftime.c b/strftime.c index 3a88208b1f..d6d1f8bd3a 100644 --- a/strftime.c +++ b/strftime.c @@ -318,6 +318,10 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept continue; case 'a': /* abbreviated weekday name */ + if (flags & BIT_OF(CHCASE)) { + flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE)); + flags |= BIT_OF(UPPER); + } if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6) i = 1, tp = "?"; else @@ -325,6 +329,10 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept break; case 'A': /* full weekday name */ + if (flags & BIT_OF(CHCASE)) { + flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE)); + flags |= BIT_OF(UPPER); + } if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6) i = 1, tp = "?"; else @@ -335,6 +343,10 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept case 'h': /* abbreviated month name */ #endif case 'b': /* abbreviated month name */ + if (flags & BIT_OF(CHCASE)) { + flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE)); + flags |= BIT_OF(UPPER); + } if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11) i = 1, tp = "?"; else @@ -342,6 +354,10 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept break; case 'B': /* full month name */ + if (flags & BIT_OF(CHCASE)) { + flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE)); + flags |= BIT_OF(UPPER); + } if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11) i = 1, tp = "?"; else |