aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/time
diff options
context:
space:
mode:
authorBrian Inglis <Brian.Inglis@SystematicSW.ab.ca>2022-10-21 23:15:18 -0600
committerCorinna Vinschen <corinna@vinschen.de>2022-10-24 14:07:23 +0200
commitd6a26e542da06d0ded2b8eefbd019fc93fdec019 (patch)
treebea36cc34ba881ae88fd356c9b214d24a878b83f /newlib/libc/time
parent7589034cc3151bfac8cc3d3af5e91402a78e160b (diff)
downloadnewlib-d6a26e542da06d0ded2b8eefbd019fc93fdec019.zip
newlib-d6a26e542da06d0ded2b8eefbd019fc93fdec019.tar.gz
newlib-d6a26e542da06d0ded2b8eefbd019fc93fdec019.tar.bz2
strptime.c(strptime_l): add %q GNU quarter
Diffstat (limited to 'newlib/libc/time')
-rw-r--r--newlib/libc/time/strptime.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c
index 12b2ef4..6220ff7 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)