diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 16 |
1 files changed, 9 insertions, 7 deletions
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 = { | |||
13351 | static int FAST_FUNC | 13351 | static int FAST_FUNC |
13352 | timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | 13352 | timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
13353 | { | 13353 | { |
13354 | unsigned long clk_tck, s, t; | 13354 | unsigned clk_tck; |
13355 | const unsigned char *p; | 13355 | const unsigned char *p; |
13356 | struct tms buf; | 13356 | struct tms buf; |
13357 | 13357 | ||
13358 | clk_tck = bb_clk_tck(); | 13358 | clk_tck = bb_clk_tck(); |
13359 | times(&buf); | ||
13360 | 13359 | ||
13360 | times(&buf); | ||
13361 | p = timescmd_str; | 13361 | p = timescmd_str; |
13362 | do { | 13362 | do { |
13363 | unsigned sec, frac; | ||
13364 | unsigned long t; | ||
13363 | t = *(clock_t *)(((char *) &buf) + p[1]); | 13365 | t = *(clock_t *)(((char *) &buf) + p[1]); |
13364 | s = t / clk_tck; | 13366 | sec = t / clk_tck; |
13365 | t = t % clk_tck; | 13367 | frac = t % clk_tck; |
13366 | out1fmt("%lum%lu.%03lus%c", | 13368 | out1fmt("%um%u.%03us%c", |
13367 | s / 60, s % 60, | 13369 | sec / 60, sec % 60, |
13368 | (t * 1000) / clk_tck, | 13370 | (frac * 1000) / clk_tck, |
13369 | p[0]); | 13371 | p[0]); |
13370 | p += 2; | 13372 | p += 2; |
13371 | } while (*p); | 13373 | } while (*p); |