On Mon, 17 Jan 2005, Roland McGrath wrote:
Shouldn't msecs mean msecs, not secs/HZ?
Hmm, sure, but why go through "msecs" at all?
--- linux-2.6/include/asm-generic/cputime.h
+++ linux-2.6/include/asm-generic/cputime.h
@@ -35,8 +35,8 @@ typedef u64 cputime64_t;
/*
* Convert cputime to seconds and back.
*/
-#define cputime_to_secs(__ct) (jiffies_to_msecs(__ct) / HZ)
-#define secs_to_cputime(__secs) (msecs_to_jiffies(__secs * HZ))
+#define cputime_to_secs(__ct) (jiffies_to_msecs(__ct) / 1000)
+#define secs_to_cputime(__secs) (msecs_to_jiffies(__secs * 1000))
iow, why not
#define cputime_to_secs(jif) ((jif) / HZ)
#define secs_to_cputime(sec) ((sec) * HZ)
which avoids double rounding issues etc.