From 722a5c0462f38827f4097065bfc3826b9e0e9fb4 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 12 May 2009 16:26:16 -0700 Subject: 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. --- libcutils/tzstrftime.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libcutils/tzstrftime.c') 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': -- cgit v1.2.3