public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: zippel@linux-m68k.org
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, john stultz <johnstul@us.ibm.com>
Subject: [NTP 3/9] add time_freq to tick length
Date: Thu, 10 Aug 2006 02:01:49 +0200	[thread overview]
Message-ID: <20060810001114.155770000@linux-m68k.org> (raw)
In-Reply-To: 20060810000146.913645000@linux-m68k.org

[-- Attachment #1: 0003-NTP-add-time_freq-to-tick-length.txt --]
[-- Type: text/plain, Size: 1852 bytes --]

This adds the frequency part to ntp_update_frequency().

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
---
 kernel/time/ntp.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Index: linux-2.6-mm/kernel/time/ntp.c
===================================================================
--- linux-2.6-mm.orig/kernel/time/ntp.c
+++ linux-2.6-mm/kernel/time/ntp.c
@@ -43,8 +43,7 @@ long time_tolerance = MAXFREQ;		/* frequ
 long time_precision = 1;		/* clock precision (us)		*/
 long time_maxerror = NTP_PHASE_LIMIT;	/* maximum error (us)		*/
 long time_esterror = NTP_PHASE_LIMIT;	/* estimated error (us)		*/
-long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC;
-					/* frequency offset (scaled ppm)*/
+long time_freq;				/* frequency offset (scaled ppm)*/
 long time_reftime;			/* time at last adjustment (s)	*/
 long time_adjust;
 long time_next_adjust;
@@ -73,6 +72,7 @@ void ntp_update_frequency(void)
 {
 	tick_length_base = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) << TICK_LENGTH_SHIFT;
 	tick_length_base += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT;
+	tick_length_base += ((s64)time_freq * NSEC_PER_USEC) << (TICK_LENGTH_SHIFT - SHIFT_USEC);
 
 	do_div(tick_length_base, HZ);
 
@@ -169,8 +169,6 @@ void second_overflow(void)
 	 * Compute the frequency estimate and additional phase adjustment due
 	 * to frequency error for the next second.
 	 */
-	ltemp = time_freq;
-	time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE));
 
 #if HZ == 100
 	/*
@@ -395,7 +393,7 @@ int do_adjtimex(struct timex *txc)
 	    if (txc->modes & ADJ_TICK)
 		tick_usec = txc->tick;
 
-	    if (txc->modes & ADJ_TICK)
+	    if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET))
 		    ntp_update_frequency();
 	} /* txc->modes */
 leave:	if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)

--


  parent reply	other threads:[~2006-08-10  0:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10  0:01 [NTP 0/9] NTP patches zippel
2006-08-10  0:01 ` [NTP 1/9] add ntp_update_frequency zippel
2006-08-10  0:01 ` [NTP 2/9] add time_adj to tick length zippel
2006-08-10  0:01 ` zippel [this message]
2006-08-10  0:01 ` [NTP 4/9] prescale time_offset zippel
2006-08-10  0:01 ` [NTP 5/9] add time_adjust to tick length zippel
2006-08-20 15:33   ` Atsushi Nemoto
2006-08-20 17:25     ` Roman Zippel
2006-08-10  0:01 ` [NTP 6/9] remove time_tolerance zippel
2006-08-10  0:01 ` [NTP 7/9] convert time_freq to nsec value zippel
2006-08-10  0:01 ` [NTP 8/9] convert to the NTP4 reference model zippel
2006-08-10 18:49   ` Andrew Morton
2006-08-10 19:14     ` Roman Zippel
2006-08-10 19:29       ` Andrew Morton
2006-08-10 19:59         ` Roman Zippel
2006-08-10  0:01 ` [NTP 9/9] cleanup defines and comments zippel
2006-08-16 23:07 ` [NTP 0/9] NTP patches john stultz
2006-08-17 10:32   ` 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=20060810001114.155770000@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --cc=akpm@osdl.org \
    --cc=johnstul@us.ibm.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