From 11f2e99c13b42675bb65cf2cfd3e3a98f95f2cee Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 10 Aug 2017 16:34:03 +0200 Subject: hush: optional times builtin function old new delta builtin_times - 108 +108 bltins1 360 372 +12 static.times_tbl - 9 +9 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 1/0 up/down: 129/0) Total: 129 bytes Signed-off-by: Denys Vlasenko --- shell/ash.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index fd1772351..5c03f1fdc 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -13351,21 +13351,23 @@ static const unsigned char timescmd_str[] ALIGN1 = { static int FAST_FUNC timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) { - unsigned long clk_tck, s, t; + unsigned clk_tck; const unsigned char *p; struct tms buf; clk_tck = bb_clk_tck(); - times(&buf); + times(&buf); p = timescmd_str; do { + unsigned sec, frac; + unsigned long t; t = *(clock_t *)(((char *) &buf) + p[1]); - s = t / clk_tck; - t = t % clk_tck; - out1fmt("%lum%lu.%03lus%c", - s / 60, s % 60, - (t * 1000) / clk_tck, + sec = t / clk_tck; + frac = t % clk_tck; + out1fmt("%um%u.%03us%c", + sec / 60, sec % 60, + (frac * 1000) / clk_tck, p[0]); p += 2; } while (*p); -- cgit v1.2.3