diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-18 15:36:48 +0200 | 
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-18 15:36:48 +0200 | 
| commit | 8cd9f343e74ca65f36c42a44e845716ba5411663 (patch) | |
| tree | 491ffc11553f9de9b91c890f82dc0668c44660e8 | |
| parent | b87c17cd16f1b23a07a65ee90a3e30a49992fa51 (diff) | |
| download | busybox-8cd9f343e74ca65f36c42a44e845716ba5411663.tar.gz | |
ash: times builtin: use unsigned type; take free-of-charge modulo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | shell/ash.c | 9 | 
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 = {  static int FAST_FUNC  timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)  { -	long clk_tck, s, t; +	unsigned long clk_tck, s, t;  	const unsigned char *p;  	struct tms buf; @@ -12519,9 +12519,10 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)  	do {  		t = *(clock_t *)(((char *) &buf) + p[1]);  		s = t / clk_tck; -		out1fmt("%ldm%ld.%.3lds%c", -			s/60, s%60, -			((t - s * clk_tck) * 1000) / clk_tck, +		t = t % clk_tck; +		out1fmt("%lum%lu.%03lus%c", +			s / 60, s % 60, +			(t * 1000) / clk_tck,  			p[0]);  		p += 2;  	} while (*p);  | 
