From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13990 invoked by alias); 3 Nov 2016 19:46:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 13973 invoked by uid 89); 3 Nov 2016 19:46:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Quarter, quarter X-HELO: mail2.vodafone.ie X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao4JAIceUldtT4V7/2dsb2JhbABegzoihCe1YIQJhhKBNkwBAQEBAQFmJ4RIFhVSKIFLiBGnL5tlhS+KUYF9C0CCRgWYRY4miVaFQgKPUlSBNgEBCIIuPIpEAQEB From: =?UTF-8?q?P=C3=A1draig=20Brady?= To: libc-alpha@sourceware.org Cc: =?UTF-8?q?P=C3=A1draig=20Brady?= Subject: [PATCH] strftime: support %q to output the quarter of year Date: Thu, 03 Nov 2016 19:46:00 -0000 Message-Id: <1478202401-5238-1-git-send-email-P@draigBrady.com> X-SW-Source: 2016-11/txt/msg00114.txt.bz2 This is already supported by gnulib. * manual/time.texi: Document %q outputs quarter 1..4. * time/strftime_l.c: Implement %q. --- manual/time.texi | 6 ++++++ time/strftime_l.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/manual/time.texi b/manual/time.texi index 8a5f94e..f4c5f87 100644 --- a/manual/time.texi +++ b/manual/time.texi @@ -1510,6 +1510,12 @@ most locales @samp{AM}/@samp{PM} format is not supported, in such cases This format is a GNU extension. +@item %q +Quarter of the year (@samp{1}@dots{}@samp{4}), +with January starting the first quarter. + +This format is a GNU extension. + @item %r The complete calendar time using the AM/PM format of the current locale. diff --git a/time/strftime_l.c b/time/strftime_l.c index 869e0b9..13db490 100644 --- a/time/strftime_l.c +++ b/time/strftime_l.c @@ -1108,6 +1108,10 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument goto underlying_strftime; #endif + case L_('q'): /* GNU extension. */ + DO_SIGNED_NUMBER (1, tp->tm_mon < -3, tp->tm_mon / 3 + 1U); + break; + case L_('R'): subfmt = L_("%H:%M"); goto subformat; -- 2.5.5