mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] strptime: Add %F format (glibc extension).
@ 2018-02-22 21:53 Przemyslaw Pawelczyk
  2018-02-22 23:44 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Przemyslaw Pawelczyk @ 2018-02-22 21:53 UTC (permalink / raw)
  To: musl

%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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-23 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 21:53 [PATCH] strptime: Add %F format (glibc extension) Przemyslaw Pawelczyk
2018-02-22 23:44 ` Rich Felker
2018-02-23 10:56   ` Natanael Copa

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).