public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: zippel@linux-m68k.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH 5/8] support for TAI
Date: Fri, 14 Mar 2008 13:55:05 -0700	[thread overview]
Message-ID: <1205528105.6122.23.camel@localhost.localdomain> (raw)
In-Reply-To: <20080314195737.035249969@linux-m68k.org>


On Fri, 2008-03-14 at 19:40 +0100, zippel@linux-m68k.org wrote:
> plain text document attachment (time_tai)
> This adds support for setting the TAI value (International Atomic Time).
> The value is reported back to userspace via timex (as we don't have a
> ntp_gettime() syscall).
> 
> Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
> 

Very cool. I just was talking with someone who was looking for a TAI
interface. 

Minor nit below.

-john


> 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
> @@ -35,6 +35,7 @@ static u64 tick_length, tick_length_base
>  /* TIME_ERROR prevents overwriting the CMOS clock */
>  static int time_state = TIME_OK;	/* clock synchronization status	*/
>  int time_status = STA_UNSYNC;		/* clock status bits		*/
> +static long time_tai;			/* TAI offset (s)		*/

I think timekeeping.c would be the better place for time_tai, keeping it
closer to xtime and wall_to_monotonic's definitions.


>  static s64 time_offset;			/* time adjustment (ns)		*/
>  static long time_constant = 2;		/* pll time constant		*/
>  long time_maxerror = NTP_PHASE_LIMIT;	/* maximum error (us)		*/
> @@ -162,6 +163,7 @@ void second_overflow(void)
>  	case TIME_DEL:
>  		if ((xtime.tv_sec + 1) % 86400 == 0) {
>  			xtime.tv_sec++;
> +			time_tai--;
>  			wall_to_monotonic.tv_sec--;
>  			time_state = TIME_WAIT;
>  			printk(KERN_NOTICE "Clock: deleting leap second "
> @@ -169,6 +171,7 @@ void second_overflow(void)
>  		}
>  		break;
>  	case TIME_OOP:
> +		time_tai++;
>  		time_state = TIME_WAIT;
>  		break;
>  	case TIME_WAIT:


These manipulations could also be done in the
timekeeping_insert/remove_second interface I suggested earlier.


> @@ -340,6 +343,9 @@ int do_adjtimex(struct timex *txc)
>  			time_constant = max(time_constant, 0l);
>  		}
> 
> +		if (txc->modes & ADJ_TAI && txc->constant > 0)
> +			time_tai = txc->constant;
> +
>  		if (txc->modes & ADJ_OFFSET) {
>  			if (txc->modes == ADJ_OFFSET_SINGLESHOT)
>  				/* adjtime() is independent from ntp_adjtime() */
> @@ -375,6 +381,7 @@ int do_adjtimex(struct timex *txc)
>  	txc->precision	   = 1;
>  	txc->tolerance	   = MAXFREQ_SCALED / PPM_SCALE;
>  	txc->tick	   = tick_usec;
> +	txc->tai	   = time_tai;
> 
>  	/* PPS is not implemented, so these are zero */
>  	txc->ppsfreq	   = 0;
> 


  reply	other threads:[~2008-03-14 20:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-14 18:40 [PATCH 0/8] NTP updates zippel
2008-03-14 18:40 ` [PATCH 1/8] cleanup ntp.c zippel
2008-03-14 20:30   ` john stultz
2008-03-15  3:21     ` Roman Zippel
2008-03-14 18:40 ` [PATCH 2/8] NTP4 user space bits update zippel
2008-03-14 20:36   ` john stultz
2008-03-15  3:29     ` Roman Zippel
2008-03-14 18:40 ` [PATCH 3/8] increase time_freq resolution zippel
2008-03-14 18:40 ` [PATCH 4/8] increase time_offset resolution zippel
2008-03-14 18:40 ` [PATCH 5/8] support for TAI zippel
2008-03-14 20:55   ` john stultz [this message]
2008-03-14 18:40 ` [PATCH 6/8] Rename TICK_LENGTH_SHIFT to NTP_SCALE_SHIFT zippel
2008-03-14 18:40 ` [PATCH 7/8] Remove current_tick_length() zippel
2008-03-15  2:41   ` john stultz
2008-03-15  3:32     ` Roman Zippel
2008-03-15  3:48       ` john stultz
2008-03-15  4:18         ` Roman Zippel
2008-03-15 16:29           ` Ray Lee
2008-03-15 17:14             ` Roman Zippel
2008-03-18  1:01               ` john stultz
2008-03-26  1:53                 ` Roman Zippel
2008-03-14 18:40 ` [PATCH 8/8] handle leap second via timer zippel
2008-03-14 20:24   ` john stultz
2008-03-15  3:18     ` Roman Zippel
2008-03-17 22:18       ` Andrew Morton
2008-03-21 14:15         ` Thomas Gleixner
2008-03-14 23:03 ` [PATCH 0/8] NTP updates john stultz
2008-03-15  3:15   ` 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=1205528105.6122.23.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.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