summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-23 20:21:52 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:31:32 +0200
commit7b027a34676880bded1a05a5c47bfa85a6e79092 (patch)
tree01636581353ad02bdb86634f2d927caace705a8e /process.c
parent434f79cbfa00c7370724dc25091b5a42bdf8d9e1 (diff)
Make sure the clock never runs backwards.
* process.c, rootdir.c: When converting timeval structures into seconds or jiffies, make sure that floating point rounding errors don't make the clock the result jump backwards on second boundaries.
Diffstat (limited to 'process.c')
-rw-r--r--process.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/process.c b/process.c
index 1f9d578..68e7bc1 100644
--- a/process.c
+++ b/process.c
@@ -58,8 +58,8 @@ static const char *state_string (struct proc_stat *ps)
static long long int timeval_jiffies (time_value_t tv)
{
- double secs = tv.seconds + tv.microseconds / 1000000.;
- return secs * opt_clk_tck;
+ double secs = tv.seconds * 1000000. + tv.microseconds;
+ return secs * opt_clk_tck / 1000000.;
}
/* Actual content generators */