Re: [PATCH 5/8] support for TAI

Previous thread: [PATCH 8/8] handle leap second via timer by zippel on Friday, March 14, 2008 - 11:40 am. (5 messages)

Next thread: Re: Keys get stuck by Bodo Eggert on Friday, March 14, 2008 - 1:20 pm. (1 message)
From: zippel
Date: Friday, March 14, 2008 - 11:40 am

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>

---
 include/linux/compat.h |    3 ++-
 include/linux/timex.h  |    4 +++-
 kernel/compat.c        |    3 ++-
 kernel/time/ntp.c      |    7 +++++++
 4 files changed, 14 insertions(+), 3 deletions(-)

Index: linux-2.6-mm/include/linux/compat.h
===================================================================
--- linux-2.6-mm.orig/include/linux/compat.h
+++ linux-2.6-mm/include/linux/compat.h
@@ -65,10 +65,11 @@ struct compat_timex {
 	compat_long_t calcnt;
 	compat_long_t errcnt;
 	compat_long_t stbcnt;
+	compat_int_t tai;
 
 	compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
 	compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
-	compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
+	compat_int_t :32; compat_int_t :32; compat_int_t :32;
 };
 
 #define _COMPAT_NSIG_WORDS	(_COMPAT_NSIG / _COMPAT_NSIG_BPW)
Index: linux-2.6-mm/include/linux/timex.h
===================================================================
--- linux-2.6-mm.orig/include/linux/timex.h
+++ linux-2.6-mm/include/linux/timex.h
@@ -116,9 +116,11 @@ struct timex {
 	long errcnt;            /* calibration errors (ro) */
 	long stbcnt;            /* stability limit exceeded (ro) */
 
+	int tai;		/* TAI offset (ro) */
+
 	int  :32; int  :32; int  :32; int  :32;
 	int  :32; int  :32; int  :32; int  :32;
-	int  :32; int  :32; int  :32; int  :32;
+	int  :32; int  :32; int  :32;
 };
 
 /*
@@ -135,6 +135,7 @@ struct timex {
 #define ADJ_ESTERROR		0x0008	/* estimated time error */
 #define ADJ_STATUS		0x0010	/* clock status */
 #define ADJ_TIMECONST		0x0020	/* pll time constant */
+#define ADJ_TAI			0x0080	/* set TAI offset */
 #define ADJ_MICRO		0x1000	/* select microsecond resolution */
 #define ADJ_NANO		0x2000	/* ...
From: john stultz
Date: Friday, March 14, 2008 - 1:55 pm

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

Minor nit below.


I think timekeeping.c would be the better place for time_tai, keeping it


These manipulations could also be done in the

--

Previous thread: [PATCH 8/8] handle leap second via timer by zippel on Friday, March 14, 2008 - 11:40 am. (5 messages)

Next thread: Re: Keys get stuck by Bodo Eggert on Friday, March 14, 2008 - 1:20 pm. (1 message)