[PATCH] strptime.c(strptime_l): add %q GNU quarter

Brian Inglis <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
---
 newlib/libc/time/strptime.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
0001-strptime.c-strptime_l-add-q-GNU-quarter.patch (text/x-patch, 851 B)
diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c
index 12b2ef4695de..6220ff73ad27 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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.