]> Savannah Git Hosting - gnulib.git/commitdiff
strftime: tune %q
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 13 Nov 2016 01:40:26 +0000 (17:40 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 13 Nov 2016 01:41:34 +0000 (17:41 -0800)
* lib/strftime.c (__strftime_internal): Assume tp->tm_mon is in range.

ChangeLog
lib/strftime.c

index a748d7a02fcca3be8779b656ea6e715796fde8fa..2a61a471e020c7e57ecb5cc89242462721b682f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-11-12  Paul Eggert  <eggert@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
index 00870f63aaf00ca29a6734bc829d833b9379b8ea..b906e3cae65658278bbe56ea6e3d406eba6e9cef 100644 (file)
@@ -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'):