summaryrefslogtreecommitdiffstats
path: root/libcutils/tzstrftime.c
diff options
context:
space:
mode:
authorEric Fischer <enf@google.com>2009-05-12 16:26:16 -0700
committerEric Fischer <enf@google.com>2009-05-14 17:22:20 -0700
commit722a5c0462f38827f4097065bfc3826b9e0e9fb4 (patch)
treee44fd6f2b06504dd673e3f66917386a120576911 /libcutils/tzstrftime.c
parentc83cd879d45e667fbb4763f18c908928ee9d67d8 (diff)
downloadcore-722a5c0462f38827f4097065bfc3826b9e0e9fb4.tar.gz
core-722a5c0462f38827f4097065bfc3826b9e0e9fb4.tar.bz2
core-722a5c0462f38827f4097065bfc3826b9e0e9fb4.zip
Add support for "standalone months" to tztime's strftime().
The idea here is that some languages need a different form of the month name in constructions like "January 2" than in "January 2009", since the one in the "January 2" case really means "of January." So with this change, a format string of "%-B" will use the standalone month, while "%B" will continue to use the format month.
Diffstat (limited to 'libcutils/tzstrftime.c')
-rw-r--r--libcutils/tzstrftime.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libcutils/tzstrftime.c b/libcutils/tzstrftime.c
index 29c50154a..e37d79ae6 100644
--- a/libcutils/tzstrftime.c
+++ b/libcutils/tzstrftime.c
@@ -172,10 +172,17 @@ label:
pt, ptlim, modifier);
continue;
case 'B':
- pt = _add((t->tm_mon < 0 ||
- t->tm_mon >= MONSPERYEAR) ?
- "?" : Locale->month[t->tm_mon],
- pt, ptlim, modifier);
+ if (modifier == '-') {
+ pt = _add((t->tm_mon < 0 ||
+ t->tm_mon >= MONSPERYEAR) ?
+ "?" : Locale->standalone_month[t->tm_mon],
+ pt, ptlim, modifier);
+ } else {
+ pt = _add((t->tm_mon < 0 ||
+ t->tm_mon >= MONSPERYEAR) ?
+ "?" : Locale->month[t->tm_mon],
+ pt, ptlim, modifier);
+ }
continue;
case 'b':
case 'h':