aboutsummaryrefslogtreecommitdiff
path: root/libbb/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/time.c')
-rw-r--r--libbb/time.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c
index 41a69c754..ed4f50470 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -43,7 +43,12 @@ int FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
43 save = *ptm; 43 save = *ptm;
44 fmt = fmt_str; 44 fmt = fmt_str;
45 while (*fmt) { 45 while (*fmt) {
46#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_TIMEZONE
47 long gmtoff;
48 endp = mingw_strptime(date_str, fmt, ptm, &gmtoff);
49#else
46 endp = strptime(date_str, fmt, ptm); 50 endp = strptime(date_str, fmt, ptm);
51#endif
47 if (endp && *endp == '\0') { 52 if (endp && *endp == '\0') {
48#if ENABLE_FEATURE_TIMEZONE 53#if ENABLE_FEATURE_TIMEZONE
49 if (strchr(fmt, 'z')) { 54 if (strchr(fmt, 'z')) {
@@ -51,7 +56,11 @@ int FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
51 struct tm *utm; 56 struct tm *utm;
52 57
53 /* we have timezone offset: obtain Unix time_t */ 58 /* we have timezone offset: obtain Unix time_t */
59#if ENABLE_PLATFORM_MINGW32
60 ptm->tm_sec -= gmtoff;
61#else
54 ptm->tm_sec -= ptm->tm_gmtoff; 62 ptm->tm_sec -= ptm->tm_gmtoff;
63#endif
55 ptm->tm_isdst = 0; 64 ptm->tm_isdst = 0;
56 t = timegm(ptm); 65 t = timegm(ptm);
57 if (t == (time_t)-1) 66 if (t == (time_t)-1)