hope Jim likes this one
This commit is contained in:
parent
c956c3dbf3
commit
ff27f6d2aa
27
top.c
27
top.c
@ -733,24 +733,25 @@ static const char *scale_tics (TICS_t tics, const int width)
|
|||||||
#endif
|
#endif
|
||||||
static char buf[TNYBUFSIZ];
|
static char buf[TNYBUFSIZ];
|
||||||
unsigned ss;
|
unsigned ss;
|
||||||
TICS_t t = (tics * 100) / (TICS_t)Hertz;
|
unsigned nt; // narrow time, for speed on 32-bit
|
||||||
|
unsigned ct; // centiseconds past the second
|
||||||
|
|
||||||
if (width >= snprintf(buf, sizeof(buf), T1
|
ct = ((tics * 100) / Hertz)%100 ;
|
||||||
, (unsigned)t / 6000, (unsigned)(t / 100) % 60, (unsigned)t % 100))
|
nt = tics / Hertz;
|
||||||
|
if (width >= snprintf(buf, sizeof(buf), T1, nt/60, nt%60, ct)
|
||||||
return buf;
|
return buf;
|
||||||
t /= 100;
|
ss = nt % 60;
|
||||||
ss = t % 60;
|
nt /= 60;
|
||||||
t /= 60;
|
if (width >= snprintf(buf, sizeof buf, T2, nt, ss))
|
||||||
if (width >= snprintf(buf, sizeof(buf), T2, (unsigned)t, ss))
|
|
||||||
return buf;
|
return buf;
|
||||||
t /= 60;
|
nt /= 60;
|
||||||
if (width >= snprintf(buf, sizeof(buf), HH, (unsigned)t))
|
if (width >= snprintf(buf, sizeof buf, HH, nt))
|
||||||
return buf;
|
return buf;
|
||||||
t /= 24;
|
nt /= 24;
|
||||||
if (width >= snprintf(buf, sizeof(buf), DD, (unsigned)t))
|
if (width >= snprintf(buf, sizeof buf, DD, nt))
|
||||||
return buf;
|
return buf;
|
||||||
t /= 7;
|
nt /= 7;
|
||||||
if (width >= snprintf(buf, sizeof(buf), WW, (unsigned)t))
|
if (width >= snprintf(buf, sizeof buf, WW, nt))
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
/* well shoot, this outta' fit... */
|
/* well shoot, this outta' fit... */
|
||||||
|
Loading…
Reference in New Issue
Block a user