summaryrefslogtreecommitdiffstats
path: root/libcutils
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
parentc83cd879d45e667fbb4763f18c908928ee9d67d8 (diff)
downloadsystem_core-722a5c0462f38827f4097065bfc3826b9e0e9fb4.zip
system_core-722a5c0462f38827f4097065bfc3826b9e0e9fb4.tar.gz
system_core-722a5c0462f38827f4097065bfc3826b9e0e9fb4.tar.bz2
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')
-rw-r--r--libcutils/tzstrftime.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libcutils/tzstrftime.c b/libcutils/tzstrftime.c
index 29c5015..e37d79a 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':