Messages in this thread | | | Date | Thu, 11 Mar 2004 13:54:08 -0800 | From | George Anzinger <> | Subject | Re: rtc_gettimeofday VS. do_gettimeofday |
| |
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
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |