Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180222215339.11414-1-przemoc@gmail.com>
Date: Thu, 22 Feb 2018 22:53:39 +0100
From: Przemyslaw Pawelczyk <przemoc@...il.com>
To: musl@...ts.openwall.com
Subject: [PATCH] strptime: Add %F format (glibc extension).

%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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.