commit f088b12877dec209eb7e02cf42b2761ed52d984e
parent f2285a1a3548f24b34f5a3ba105f64b315e84e87
Author: sin <sin@2f30.org>
Date: Fri, 16 Aug 2013 15:48:45 +0100
Divide by sysconf(_SC_CLK_TCK) instead of a fixed 100
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ps.c b/ps.c
@@ -80,7 +80,7 @@ psout(struct procstat *ps)
if (ps->pid == ps->sid)
return;
- sut = (ps->stime + ps->utime) / 100;
+ sut = (ps->stime + ps->utime) / sysconf(_SC_CLK_TCK);
devtotty(ps->tty_nr, &tty_maj, &tty_min);
ttystr = ttytostr(tty_maj, tty_min);
@@ -123,7 +123,8 @@ psout(struct procstat *ps)
eprintf("getpwuid %d:", puid);
sysinfo(&info);
- start = time(NULL) - (info.uptime - (ps->starttime / 100));
+ start = time(NULL) - info.uptime;
+ start += (ps->starttime / sysconf(_SC_CLK_TCK));
tm = localtime(&start);
strftime(stimestr, sizeof(stimestr),
"%H:%M", tm);