mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Przemyslaw Pawelczyk <przemoc@gmail.com>
To: musl@lists.openwall.com
Subject: [PATCH] strptime: Add %F format (glibc extension).
Date: Thu, 22 Feb 2018 22:53:39 +0100	[thread overview]
Message-ID: <20180222215339.11414-1-przemoc@gmail.com> (raw)

%F is a shortcut for %Y-%m-%d, the ISO 8601 date format.
It's already present in POSIX's strftime(), so it makes sense to support
it in a converse function too.
---

I'm not subscribed to ML, so please CC me in case of replying.

 src/time/strptime.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/time/strptime.c b/src/time/strptime.c
index c54a0d8c4c52..2c0d45574819 100644
--- a/src/time/strptime.c
+++ b/src/time/strptime.c
@@ -59,6 +59,10 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
 			s = strptime(s, "%m/%d/%y", tm);
 			if (!s) return 0;
 			break;
+		case 'F':
+			s = strptime(s, "%Y-%m-%d", tm);
+			if (!s) return 0;
+			break;
 		case 'H':
 			dest = &tm->tm_hour;
 			min = 0;
-- 
2.13.5



             reply	other threads:[~2018-02-22 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 21:53 Przemyslaw Pawelczyk [this message]
2018-02-22 23:44 ` Rich Felker
2018-02-23 10:56   ` Natanael Copa

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=20180222215339.11414-1-przemoc@gmail.com \
    --to=przemoc@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).