ash: times builtin: use unsigned type; take free-of-charge modulo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -12508,7 +12508,7 @@ static const unsigned char timescmd_str[] ALIGN1 = {
|
|||||||
static int FAST_FUNC
|
static int FAST_FUNC
|
||||||
timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||||
{
|
{
|
||||||
long clk_tck, s, t;
|
unsigned long clk_tck, s, t;
|
||||||
const unsigned char *p;
|
const unsigned char *p;
|
||||||
struct tms buf;
|
struct tms buf;
|
||||||
|
|
||||||
@@ -12519,9 +12519,10 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
|||||||
do {
|
do {
|
||||||
t = *(clock_t *)(((char *) &buf) + p[1]);
|
t = *(clock_t *)(((char *) &buf) + p[1]);
|
||||||
s = t / clk_tck;
|
s = t / clk_tck;
|
||||||
out1fmt("%ldm%ld.%.3lds%c",
|
t = t % clk_tck;
|
||||||
s/60, s%60,
|
out1fmt("%lum%lu.%03lus%c",
|
||||||
((t - s * clk_tck) * 1000) / clk_tck,
|
s / 60, s % 60,
|
||||||
|
(t * 1000) / clk_tck,
|
||||||
p[0]);
|
p[0]);
|
||||||
p += 2;
|
p += 2;
|
||||||
} while (*p);
|
} while (*p);
|
||||||
|
Reference in New Issue
Block a user