[lkml]   [2001]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectdelaying "milliseconds" in the kernel

I'm writing a driver, and want to delay n milliseconds
in an algorithm.

Timers need jiffies, so I need to convert.

Is there a standard to define time? (I didn't see it -- seems
everything is in HZ).

I wanted a macro or something so I could express my constraint
in milliseconds, and it would be converted to jiffies...

I wanted something like a macro:
#define MSECS_TO_JIFFIES(x) (x*(HZ/1000))

It seems there is no "standard" way to do this in the kernel
(I ran gid on 2.4.5).

The only think I easily saw was:
drivers/isdn/sc/hardware.h:112:#define milliseconds(x) (x/(1000/HZ))
which would do what I wanted...I would want to see this at a higher level...

Instead of throwing around HZ everywhere (and having to inuitate how this
mapped time to jiffies), would it be a good idea to have some
standard way to express milliseconds -- since time is important,
jiffies are an implementation detail.

I think the code would be much clear if I saw
instead of


Don't confuse education with schooling.
Milton Friedman to Yogi Berra
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:12    [W:0.026 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site