public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Abhishek Rai <abba@fsl.cs.sunysb.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: rtc_gettimeofday VS. do_gettimeofday
Date: Thu, 11 Mar 2004 13:54:08 -0800	[thread overview]
Message-ID: <4050E000.4030802@mvista.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0403061024150.15658-100000@filer.fsl.cs.sunysb.edu>

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


      reply	other threads:[~2004-03-11 21:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-06 15:27 rtc_gettimeofday VS. do_gettimeofday Abhishek Rai
2004-03-11 21:54 ` George Anzinger [this message]

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=4050E000.4030802@mvista.com \
    --to=george@mvista.com \
    --cc=abba@fsl.cs.sunysb.edu \
    --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