From 11f950597e7f66132a2ce6c8120f7199ba02316f Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Tue, 22 Aug 2017 15:10:27 -0600 Subject: [PATCH] winsup/cygwin/libc/strptime.cc(__strptime) add strptime %s --- winsup/cygwin/libc/strptime.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc index 62dca6e5e..a7fef4985 100644 --- a/winsup/cygwin/libc/strptime.cc +++ b/winsup/cygwin/libc/strptime.cc @@ -573,6 +573,29 @@ 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; + int errno_save; + char *end; + + LEGAL_ALT(0); + errno_save = errno; + errno = 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; + errno = errno_save; + 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. */ /* -- 2.14.0