diff options
author | Denys Vlasenko | 2013-03-29 12:30:33 +0100 |
---|---|---|
committer | Denys Vlasenko | 2013-03-29 12:30:33 +0100 |
commit | 8f2cb7ab26b9c720c24cdeffb624bfe0c2352353 (patch) | |
tree | 8d76825f24632d338118919b0553f542fdd3a8aa /networking | |
parent | 6c852bfcadd78f53ec7a5f35882636a2a4a66eb0 (diff) | |
download | busybox-8f2cb7ab26b9c720c24cdeffb624bfe0c2352353.zip busybox-8f2cb7ab26b9c720c24cdeffb624bfe0c2352353.tar.gz |
libbb: introduce and use strftime_[YYYYMMDD]HHMMSS()
function old new delta
strftime_fmt - 53 +53
strftime_YYYYMMDDHHMMSS - 12 +12
strftime_HHMMSS - 12 +12
human_time 44 43 -1
fmtstr_t 9 - -9
step_time 361 345 -16
watch_main 261 232 -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/3 up/down: 77/-55) Total: 22 bytes
text data bss dec hex filename
919203 932 17692 937827 e4f63 busybox_old
919209 932 17692 937833 e4f69 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ntpd.c | 4 | ||||
-rw-r--r-- | networking/ntpd_simple.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index 79b7c37..0f4319e 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -887,11 +887,11 @@ step_time(double offset) VERB2 { tval = tvc.tv_sec; - strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&tval)); + strftime_YYYYMMDDHHMMSS(buf, sizeof(buf), &tval); bb_error_msg("current time is %s.%06u", buf, (unsigned)tvc.tv_usec); } tval = tvn.tv_sec; - strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&tval)); + strftime_YYYYMMDDHHMMSS(buf, sizeof(buf), &tval); bb_error_msg("setting time to %s.%06u (offset %+fs)", buf, (unsigned)tvn.tv_usec, offset); /* Correct various fields which contain time-relative values: */ diff --git a/networking/ntpd_simple.c b/networking/ntpd_simple.c index 55bded8..3e7fc47 100644 --- a/networking/ntpd_simple.c +++ b/networking/ntpd_simple.c @@ -378,7 +378,7 @@ step_time_once(double offset) bb_perror_msg_and_die("settimeofday"); tval = tv.tv_sec; - strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %Z %Y", localtime(&tval)); + strftime_YYYYMMDDHHMMSS(buf, sizeof(buf), &tval); bb_error_msg("setting clock to %s (offset %fs)", buf, offset); |