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>
diff --git a/coreutils/stat.c b/coreutils/stat.c
index c8677eb..dc9d81c 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -127,7 +127,7 @@
/*static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")] ALIGN1;*/
#define buf bb_common_bufsiz1
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S.000000000", localtime(&t));
+ strcpy(strftime_YYYYMMDDHHMMSS(buf, sizeof(buf), &t), ".000000000");
return buf;
#undef buf
}