public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] strptime.c(strptime_l): add %q GNU quarter
@ 2022-10-24 12:09 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-10-24 12:09 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d6a26e542da06d0ded2b8eefbd019fc93fdec019
commit d6a26e542da06d0ded2b8eefbd019fc93fdec019
Author: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Date: Fri Oct 21 23:15:18 2022 -0600
strptime.c(strptime_l): add %q GNU quarter
Diff:
---
newlib/libc/time/strptime.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c
index 12b2ef469..6220ff73a 100644
--- a/newlib/libc/time/strptime.c
+++ b/newlib/libc/time/strptime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -298,6 +298,14 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr,
} else
timeptr->tm_hour += 12;
break;
+ case 'q' : /* quarter year - GNU extension */
+ ret = strtol_l (buf, &s, 10, locale);
+ if (s == buf)
+ return NULL;
+ timeptr->tm_mon = (ret - 1)*3;
+ buf = s;
+ ymd |= SET_MON;
+ break;
case 'r' : /* %I:%M:%S %p */
s = strptime_l (buf, _ctloc (ampm_fmt), timeptr, locale);
if (s == NULL)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-24 12:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 12:09 [newlib-cygwin] strptime.c(strptime_l): add %q GNU quarter Corinna Vinschen
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).