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 f09ef5d52..e7c9fa65e 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -44,12 +44,21 @@ int FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
44 save = *ptm; 44 save = *ptm;
45 fmt = fmt_str; 45 fmt = fmt_str;
46 while (*fmt) { 46 while (*fmt) {
47#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_TIMEZONE
48 long gmtoff;
49 endp = mingw_strptime(date_str, fmt, ptm, &gmtoff);
50#else
47 endp = strptime(date_str, fmt, ptm); 51 endp = strptime(date_str, fmt, ptm);
52#endif
48 if (endp && *endp == '\0') { 53 if (endp && *endp == '\0') {
49# if ENABLE_FEATURE_TIMEZONE 54# if ENABLE_FEATURE_TIMEZONE
50 if (strchr(fmt, 'z')) { 55 if (strchr(fmt, 'z')) {
51 /* we have timezone offset: obtain Unix time_t */ 56 /* we have timezone offset: obtain Unix time_t */
57#if ENABLE_PLATFORM_MINGW32
58 ptm->tm_sec -= gmtoff;
59#else
52 ptm->tm_sec -= ptm->tm_gmtoff; 60 ptm->tm_sec -= ptm->tm_gmtoff;
61#endif
53 ptm->tm_isdst = 0; 62 ptm->tm_isdst = 0;
54 t = timegm(ptm); 63 t = timegm(ptm);
55 if (t == (time_t)-1) 64 if (t == (time_t)-1)