diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-10-05 12:53:25 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-10-05 12:53:25 +0200 |
commit | 6e2beb7dfee1a4542eca1a6e8c0f33486d9d5fb9 (patch) | |
tree | 81e0c5baf5cf87aeb7635f55ec4bdbabe28b2aca /coreutils | |
parent | b5d9ba8fe64a0aacf99fd1eec10375a98104a5ea (diff) | |
download | busybox-w32-6e2beb7dfee1a4542eca1a6e8c0f33486d9d5fb9.tar.gz busybox-w32-6e2beb7dfee1a4542eca1a6e8c0f33486d9d5fb9.tar.bz2 busybox-w32-6e2beb7dfee1a4542eca1a6e8c0f33486d9d5fb9.zip |
date: maybe_set_utc only once
It's not clear at all why we do it twice. git archaeology did not help.
function old new delta
date_main 836 839 +3
maybe_set_utc 16 - -16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/date.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index 5b15ce778..87dc3bbd0 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -36,8 +36,8 @@ | |||
36 | //config:# defaults to "no": stat's nanosecond field is a bit non-portable | 36 | //config:# defaults to "no": stat's nanosecond field is a bit non-portable |
37 | //config:config FEATURE_DATE_NANO | 37 | //config:config FEATURE_DATE_NANO |
38 | //config: bool "Support %[num]N nanosecond format specifier" | 38 | //config: bool "Support %[num]N nanosecond format specifier" |
39 | //config: default n | 39 | //config: default n # syscall(__NR_clock_gettime) |
40 | //config: depends on DATE # syscall(__NR_clock_gettime) | 40 | //config: depends on DATE |
41 | //config: select PLATFORM_LINUX | 41 | //config: select PLATFORM_LINUX |
42 | //config: help | 42 | //config: help |
43 | //config: Support %[num]N format specifier. Adds ~250 bytes of code. | 43 | //config: Support %[num]N format specifier. Adds ~250 bytes of code. |
@@ -203,6 +203,7 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
203 | IF_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt) | 203 | IF_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt) |
204 | ); | 204 | ); |
205 | argv += optind; | 205 | argv += optind; |
206 | |||
206 | maybe_set_utc(opt); | 207 | maybe_set_utc(opt); |
207 | 208 | ||
208 | if (ENABLE_FEATURE_DATE_ISOFMT && (opt & OPT_TIMESPEC)) { | 209 | if (ENABLE_FEATURE_DATE_ISOFMT && (opt & OPT_TIMESPEC)) { |
@@ -301,8 +302,6 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
301 | tm_time.tm_isdst = -1; | 302 | tm_time.tm_isdst = -1; |
302 | ts.tv_sec = validate_tm_time(date_str, &tm_time); | 303 | ts.tv_sec = validate_tm_time(date_str, &tm_time); |
303 | 304 | ||
304 | maybe_set_utc(opt); | ||
305 | |||
306 | /* if setting time, set it */ | 305 | /* if setting time, set it */ |
307 | if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { | 306 | if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { |
308 | bb_perror_msg("can't set date"); | 307 | bb_perror_msg("can't set date"); |