[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: need time in nano seconds



On Mon, 2004-12-13 at 19:59 +0530, Micheal Mukherji wrote:
> Hello,
> Kindly excuse me for posting this on debian thread...I dont know
> whether it is apt or not, but as I am using Debian, I am posting
> this..
> 
> Can somebody tell me how I can get time elapsed in nanoseconds
> (possibly a function)?
> I have looked at the date command, but it is getting overflown with in
> a couple of seconds, so on a second probe I dont know how many times
> it has overflown...
> 
> I also googled for it, but all it was showing was links to RTLinux pages.
> 
> Having got dismayed, I am posting on this list.
> 
> If somebody knows, please let me too.
> 
> Thanks in anticipation.

Not even the VAX and Alpha (which use a signed 64 bit timer, with
an epoch of 17-Nov-1858 00:00:00.000, does nanosecond.  It's timer
is 100ns ticks.

Maybe when the Linux timer uses 64 bits, then we'll get nanosecond
resolution.

Remember, though, that a ns is 1 billionth of a second, and so a
3GHz CPU will onll does 3 cycles in a ns.  Unless you are coding
to the bare metal with a *minimal* OS, like DOS, you can't do
anything useful in 3 clock ticks.

After all, memory access takes, what, 60ns?

You'll probably need really specialized hardware.  An atomic clock
comes first to mind.

-- 
-----------------------------------------------------------------
Ron Johnson, Jr.
Jefferson, LA USA
PGP Key ID 8834C06B I prefer encrypted mail.

"If thine enemy offend thee, give his child a drum."
Chinese Curse

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: