aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-18 15:36:48 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-18 15:36:48 +0200
commit8cd9f343e74ca65f36c42a44e845716ba5411663 (patch)
tree491ffc11553f9de9b91c890f82dc0668c44660e8 /shell/ash.c
parentb87c17cd16f1b23a07a65ee90a3e30a49992fa51 (diff)
downloadbusybox-w32-8cd9f343e74ca65f36c42a44e845716ba5411663.tar.gz
busybox-w32-8cd9f343e74ca65f36c42a44e845716ba5411663.tar.bz2
busybox-w32-8cd9f343e74ca65f36c42a44e845716ba5411663.zip
ash: times builtin: use unsigned type; take free-of-charge modulo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 171740768..f581b5bdf 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12508,7 +12508,7 @@ static const unsigned char timescmd_str[] ALIGN1 = {
12508static int FAST_FUNC 12508static int FAST_FUNC
12509timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 12509timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12510{ 12510{
12511 long clk_tck, s, t; 12511 unsigned long clk_tck, s, t;
12512 const unsigned char *p; 12512 const unsigned char *p;
12513 struct tms buf; 12513 struct tms buf;
12514 12514
@@ -12519,9 +12519,10 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12519 do { 12519 do {
12520 t = *(clock_t *)(((char *) &buf) + p[1]); 12520 t = *(clock_t *)(((char *) &buf) + p[1]);
12521 s = t / clk_tck; 12521 s = t / clk_tck;
12522 out1fmt("%ldm%ld.%.3lds%c", 12522 t = t % clk_tck;
12523 s/60, s%60, 12523 out1fmt("%lum%lu.%03lus%c",
12524 ((t - s * clk_tck) * 1000) / clk_tck, 12524 s / 60, s % 60,
12525 (t * 1000) / clk_tck,
12525 p[0]); 12526 p[0]);
12526 p += 2; 12527 p += 2;
12527 } while (*p); 12528 } while (*p);