Thanks, and we can tune the gnulib strftime %q the same way as glibc so I installed the attached.
>From 10ee65aaa991bb2260498d4d6f6ac27bce21627d Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sat, 12 Nov 2016 17:40:26 -0800
Subject: [PATCH] strftime: tune %q

* lib/strftime.c (__strftime_internal): Assume tp->tm_mon is in range.
---
 ChangeLog      | 3 +++
 lib/strftime.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index a748d7a..2a61a47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-11-12  Paul Eggert  <egg...@cs.ucla.edu>
 
+	strftime: tune %q
+	* lib/strftime.c (__strftime_internal): Assume tp->tm_mon is in range.
+
 	Merge strftime.c changes from glibc
 	This incorporates:
 	2007-10-16 [BZ #5184] Add tzset_called argument
diff --git a/lib/strftime.c b/lib/strftime.c
index 00870f6..b906e3c 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1159,7 +1159,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
 #endif
 
         case L_('q'):           /* GNU extension.  */
-          DO_SIGNED_NUMBER (1, tp->tm_mon < -3, tp->tm_mon / 3 + 1U);
+          DO_SIGNED_NUMBER (1, false, ((tp->tm_mon * 11) >> 5) + 1);
           break;
 
         case L_('R'):
-- 
2.7.4

Reply via email to