From: "Pádraig Brady" <P@draigBrady.com>
To: libc-alpha@sourceware.org
Cc: "Pádraig Brady" <P@draigBrady.com>
Subject: [PATCH] strftime: support %q to output the quarter of year
Date: Thu, 03 Nov 2016 19:46:00 -0000 [thread overview]
Message-ID: <1478202401-5238-1-git-send-email-P@draigBrady.com> (raw)
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
next reply other threads:[~2016-11-03 19:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 19:46 Pádraig Brady [this message]
2016-11-03 19:58 ` Florian Weimer
2016-11-03 20:28 ` Adhemerval Zanella
2016-11-03 22:00 ` Joseph Myers
2016-11-04 1:47 ` Pádraig Brady
2016-11-04 4:12 ` Paul Eggert
2016-11-04 11:33 ` Rafal Luzynski
2016-11-04 14:27 ` [PATCH v3] strftime,strptime: have %q represent " Pádraig Brady
2016-11-04 11:41 ` [PATCH] strftime: support %q to output " Szabolcs Nagy
2016-11-04 12:00 ` Pádraig Brady
2016-11-04 12:08 ` Szabolcs Nagy
2016-11-04 12:23 ` Pádraig Brady
2016-11-04 12:41 ` Szabolcs Nagy
2016-11-04 12:58 ` Pádraig Brady
2016-11-04 13:12 ` keld
2016-11-04 14:12 ` Szabolcs Nagy
2016-11-04 14:57 ` Adhemerval Zanella
2016-11-05 7:19 ` keld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478202401-5238-1-git-send-email-P@draigBrady.com \
--to=p@draigbrady.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).