linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: Jack Harvard <jack.harvard@googlemail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: gettimeofday() in 2.6.24
Date: Thu, 17 Apr 2008 12:13:42 -0600	[thread overview]
Message-ID: <48079356.2090307@nortel.com> (raw)
In-Reply-To: <a72f6a3c0804171031qbba17d6pb470119d5f2ff010@mail.gmail.com>

Jack Harvard wrote:

> http://lxr.linux.no/linux+v2.6.24/arch/arm/kernel/time.c#L240
>  239#ifndef CONFIG_GENERIC_TIME
>  240void do_gettimeofday(struct timeval *tv)
>  241{
>  242        unsigned long flags;
>  243        unsigned long seq;
>  244        unsigned long usec, sec;
>  245
>  246        do {
>  247                seq = read_seqbegin_irqsave(&xtime_lock, flags);
>  248                usec = system_timer->offset();
>  249                sec = xtime.tv_sec;
>  250                usec += xtime.tv_nsec / 1000;
>  251        } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));


> but I haven't quite figured out how gettimeofday() actually gets time
> from this added timer, also how xtime is updated?


system_timer->offset() uses the added timer to return the number of 
usecs since the last timer tick.  It's potentially different for each 
specific type of arm blade, and the function often has "gettimeoffset" 
in the name.

"xtime" is updated in the core kernel code.

Chris

  reply	other threads:[~2008-04-17 18:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 17:31 gettimeofday() in 2.6.24 Jack Harvard
2008-04-17 18:13 ` Chris Friesen [this message]
2008-04-18  8:54   ` Jack Harvard
2008-04-18 14:35     ` Chris Friesen

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=48079356.2090307@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=jack.harvard@googlemail.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;
as well as URLs for NNTP newsgroup(s).