aboutsummaryrefslogtreecommitdiff
path: root/coreutils/touch.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r--coreutils/touch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 78100ba1d..7e13a27be 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -140,15 +140,17 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
140 if (opts & (OPT_d|OPT_t)) { 140 if (opts & (OPT_d|OPT_t)) {
141 struct tm tm_time; 141 struct tm tm_time;
142 time_t t; 142 time_t t;
143 int check_dst;
143 144
144 //memset(&tm_time, 0, sizeof(tm_time)); 145 //memset(&tm_time, 0, sizeof(tm_time));
145 /* Better than memset: makes "HH:MM" dates meaningful */ 146 /* Better than memset: makes "HH:MM" dates meaningful */
146 time(&t); 147 time(&t);
147 localtime_r(&t, &tm_time); 148 localtime_r(&t, &tm_time);
148 parse_datestr(date_str, &tm_time); 149 check_dst = parse_datestr(date_str, &tm_time);
149 150
150 /* Correct any day of week and day of year etc. fields */ 151 /* Correct any day of week and day of year etc. fields */
151 tm_time.tm_isdst = -1; /* Be sure to recheck dst */ 152 if (check_dst)
153 tm_time.tm_isdst = -1; /* recheck dst unless date is UTC */
152 t = validate_tm_time(date_str, &tm_time); 154 t = validate_tm_time(date_str, &tm_time);
153 155
154 timebuf[1].tv_sec = timebuf[0].tv_sec = t; 156 timebuf[1].tv_sec = timebuf[0].tv_sec = t;