Lines 279-284
int date_main(int argc UNUSED_PARAM, char **argv)
Link Here
|
279 |
time(&ts.tv_sec); |
279 |
time(&ts.tv_sec); |
280 |
#endif |
280 |
#endif |
281 |
} |
281 |
} |
|
|
282 |
#if !ENABLE_FEATURE_DATE_NANO |
283 |
ts.tv_nsec = 0; |
284 |
#endif |
282 |
localtime_r(&ts.tv_sec, &tm_time); |
285 |
localtime_r(&ts.tv_sec, &tm_time); |
283 |
|
286 |
|
284 |
/* If date string is given, update tm_time, and maybe set date */ |
287 |
/* If date string is given, update tm_time, and maybe set date */ |
Lines 301-309
int date_main(int argc UNUSED_PARAM, char **argv)
Link Here
|
301 |
if (date_str[0] != '@') |
304 |
if (date_str[0] != '@') |
302 |
tm_time.tm_isdst = -1; |
305 |
tm_time.tm_isdst = -1; |
303 |
ts.tv_sec = validate_tm_time(date_str, &tm_time); |
306 |
ts.tv_sec = validate_tm_time(date_str, &tm_time); |
|
|
307 |
ts.tv_nsec = 0; |
304 |
|
308 |
|
305 |
/* if setting time, set it */ |
309 |
/* if setting time, set it */ |
306 |
if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { |
310 |
if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) { |
307 |
bb_perror_msg("can't set date"); |
311 |
bb_perror_msg("can't set date"); |
308 |
} |
312 |
} |
309 |
} |
313 |
} |