From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
To: linux-kernel@vger.kernel.org
Subject: delaying "milliseconds" in the kernel
Date: Tue, 06 Nov 2001 16:16:18 -0500 [thread overview]
Message-ID: <200111062116.QAA05254@mailhost.eng.mc.xerox.com> (raw)
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
MSECS_TO_JIFFIES(250)
instead of
(HZ/4)
Just IMHO
marty mleisner@eng.mc.xerox.com
Don't confuse education with schooling.
Milton Friedman to Yogi Berra
reply other threads:[~2001-11-06 21:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200111062116.QAA05254@mailhost.eng.mc.xerox.com \
--to=mleisner@eng.mc.xerox.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®