summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Inglis <Brian.Inglis@SystematicSW.ab.ca>2017-08-24 13:24:28 -0600
committerCorinna Vinschen <corinna@vinschen.de>2017-08-25 11:39:11 +0200
commit8324ab5e2a08513cef052070f1e7cb228d28b7c8 (patch)
tree47f41027d2ebd6ce78b39a1a292a2e4709d0b3e2
parent3ec9892f5dd6240d8b21c8cad7874ea856040626 (diff)
downloadcygnal-8324ab5e2a08513cef052070f1e7cb228d28b7c8.tar.gz
cygnal-8324ab5e2a08513cef052070f1e7cb228d28b7c8.tar.bz2
cygnal-8324ab5e2a08513cef052070f1e7cb228d28b7c8.zip
winsup/cygwin/libc/strptime.cc(__strptime) add %s support to strptime
-rw-r--r--winsup/cygwin/libc/strptime.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc
index 62dca6e5e..7c6cc2024 100644
--- a/winsup/cygwin/libc/strptime.cc
+++ b/winsup/cygwin/libc/strptime.cc
@@ -573,6 +573,26 @@ literal:
bp = conv_num(bp, &tm->tm_sec, 0, 61, ALT_DIGITS);
continue;
+ case 's' : /* The seconds since Unix epoch - GNU extension */
+ {
+ long long sec;
+ time_t t;
+ char *end;
+ save_errno save;
+
+ LEGAL_ALT(0);
+ sec = strtoll_l ((char *)bp, &end, 10, locale);
+ t = sec;
+ if (end == (char *)bp
+ || errno != 0
+ || t != sec
+ || localtime_r (&t, tm) != tm)
+ return NULL;
+ bp = (const unsigned char *)end;
+ ymd |= SET_YDAY | SET_WDAY | SET_YMD;
+ break;
+ }
+
case 'U': /* The week of year, beginning on sunday. */
case 'W': /* The week of year, beginning on monday. */
/*