public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: linux-kernel@vger.kernel.org
Subject: CLOCK_TICK_RATE in NTP code
Date: Thu, 1 Nov 2007 15:29:14 +0000	[thread overview]
Message-ID: <20071101152914.GA19732@linux-mips.org> (raw)

kernel/time/ntp.c contains the following piece of code:

#define CLOCK_TICK_OVERFLOW     (LATCH * HZ - CLOCK_TICK_RATE)
#define CLOCK_TICK_ADJUST       (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \
                                        (s64)CLOCK_TICK_RATE)

static void ntp_update_frequency(void)
{
        u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)
                                << TICK_LENGTH_SHIFT;
        second_length += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT;
        second_length += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC);

        tick_length_base = second_length;

        do_div(second_length, HZ);
        tick_nsec = second_length >> TICK_LENGTH_SHIFT;

        do_div(tick_length_base, NTP_INTERVAL_FREQ);
}

So it uses CLOCK_TICK_RATE which on many systems but not all is defined to
the i8253 input clock.  But timekeeping on anything remotely modern makes
little use of the i8253 so I wonder the intent was here.

  Ralf

             reply	other threads:[~2007-11-01 15:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 15:29 Ralf Baechle [this message]
2007-11-04  3:08 ` CLOCK_TICK_RATE in NTP code Roman Zippel

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=20071101152914.GA19732@linux-mips.org \
    --to=ralf@linux-mips.org \
    --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