From: Paul Eggert Date: Sun, 13 Nov 2016 01:40:26 +0000 (-0800) Subject: strftime: tune %q X-Git-Tag: v1.0~6558 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=966b0a7e0ac5a1e7997a6c2ce3f2ee415e90da31;p=gnulib.git strftime: tune %q * lib/strftime.c (__strftime_internal): Assume tp->tm_mon is in range. --- diff --git a/ChangeLog b/ChangeLog index a748d7a02f..2a61a471e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-11-12 Paul Eggert + 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 00870f63aa..b906e3cae6 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'):