aboutsummaryrefslogtreecommitdiff
path: root/coreutils/date.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/date.c')
-rw-r--r--coreutils/date.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/coreutils/date.c b/coreutils/date.c
index d64ff94b9..4e62a6fb0 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -291,6 +291,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
291 291
292 /* If date string is given, update tm_time, and maybe set date */ 292 /* If date string is given, update tm_time, and maybe set date */
293 if (date_str != NULL) { 293 if (date_str != NULL) {
294 int check_dst = 1;
294 /* Zero out fields - take her back to midnight! */ 295 /* Zero out fields - take her back to midnight! */
295 tm_time.tm_sec = 0; 296 tm_time.tm_sec = 0;
296 tm_time.tm_min = 0; 297 tm_time.tm_min = 0;
@@ -301,12 +302,12 @@ int date_main(int argc UNUSED_PARAM, char **argv)
301 if (strptime(date_str, fmt_str2dt, &tm_time) == NULL) 302 if (strptime(date_str, fmt_str2dt, &tm_time) == NULL)
302 bb_error_msg_and_die(bb_msg_invalid_date, date_str); 303 bb_error_msg_and_die(bb_msg_invalid_date, date_str);
303 } else { 304 } else {
304 parse_datestr(date_str, &tm_time); 305 check_dst = parse_datestr(date_str, &tm_time);
305 } 306 }
306 307
307 /* Correct any day of week and day of year etc. fields */ 308 /* Correct any day of week and day of year etc. fields */
308 /* Be sure to recheck dst (but not if date is time_t format) */ 309 /* Be sure to recheck dst (but not if date is UTC) */
309 if (date_str[0] != '@') 310 if (check_dst)
310 tm_time.tm_isdst = -1; 311 tm_time.tm_isdst = -1;
311 ts.tv_sec = validate_tm_time(date_str, &tm_time); 312 ts.tv_sec = validate_tm_time(date_str, &tm_time);
312 ts.tv_nsec = 0; 313 ts.tv_nsec = 0;