public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* rtc_gettimeofday VS. do_gettimeofday
@ 2004-03-06 15:27 Abhishek Rai
  2004-03-11 21:54 ` George Anzinger
  0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Rai @ 2004-03-06 15:27 UTC (permalink / raw)
  To: linux-kernel

Hi,
I need a mechanism to get accurate timeofday from inside the kernel. 
Though rtc_gettimeofday() and do_gettimeofday() both look appropriate, is 
there a reason to prefer one over the other ?

Thanks !!
Abhishek


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: rtc_gettimeofday VS. do_gettimeofday
  2004-03-06 15:27 rtc_gettimeofday VS. do_gettimeofday Abhishek Rai
@ 2004-03-11 21:54 ` George Anzinger
  0 siblings, 0 replies; 2+ messages in thread
From: George Anzinger @ 2004-03-11 21:54 UTC (permalink / raw)
  To: Abhishek Rai; +Cc: linux-kernel

Abhishek Rai wrote:
> Hi,
> I need a mechanism to get accurate timeofday from inside the kernel. 
> Though rtc_gettimeofday() and do_gettimeofday() both look appropriate, is 
> there a reason to prefer one over the other ?

Well, gettimeofday is corrected by ntp, if that matters.  It also has a 
resolution down to the micro second.

The rtc, on the other hand, is an I/O device (i.e. slower) and only goes to the 
second.

If all you need is second resolution the faster way is to use the seconds part 
of xtime.  This is available as CURRENT_TIME which is defined in 
include/linux/sched.h.
-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-11 21:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-06 15:27 rtc_gettimeofday VS. do_gettimeofday Abhishek Rai
2004-03-11 21:54 ` George Anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox