]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
local: add support for setting TAI-UTC offset
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 29 Jun 2017 13:14:16 +0000 (15:14 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 30 Jun 2017 11:43:35 +0000 (13:43 +0200)
local.c
local.h
localp.h
reference.c
sys_timex.c

diff --git a/local.c b/local.c
index e5ac43f46cf79602cd869715f50d496463f34154..b4baaac457009cef66df353c9d641bc6765a4277 100644 (file)
--- a/local.c
+++ b/local.c
@@ -700,10 +700,10 @@ LCL_CanSystemLeap(void)
 /* ================================================== */
 
 void
-LCL_SetSystemLeap(int leap)
+LCL_SetSystemLeap(int leap, int tai_offset)
 {
   if (drv_set_leap) {
-    (drv_set_leap)(leap);
+    (drv_set_leap)(leap, tai_offset);
   }
 }
 
diff --git a/local.h b/local.h
index 618a0bd046cb293ef9559947729c48d5f557aadf..7ceb76ad50bb051e18fbd52b182f84981c27cc54 100644 (file)
--- a/local.h
+++ b/local.h
@@ -201,10 +201,11 @@ extern int LCL_MakeStep(void);
    does something */
 extern int LCL_CanSystemLeap(void);
 
-/* Routine to set the system clock to correct itself for a leap second if
-   supported.  Leap second will be inserted at the end of the day if the
-   argument is positive, deleted if negative, and zero resets the setting. */
-extern void LCL_SetSystemLeap(int leap);
+/* Routine to set the system clock to correct itself for a leap second and also
+   set its TAI-UTC offset.  If supported, leap second will be inserted at the
+   end of the day if the argument is positive, deleted if negative, and zero
+   resets the setting. */
+extern void LCL_SetSystemLeap(int leap, int tai_offset);
 
 /* Routine to set a frequency correction (in ppm) that should be applied
    to local clock to compensate for temperature changes.  A positive
index fbbeb3e1a9692bcd32810f2936b7645beaa53596..6f65e433cfdf5e5fe07049b371c0fdabf901e434 100644 (file)
--- a/localp.h
+++ b/localp.h
@@ -54,8 +54,8 @@ typedef int (*lcl_ApplyStepOffsetDriver)(double offset);
    raw time to get the corrected time */
 typedef void (*lcl_OffsetCorrectionDriver)(struct timespec *raw, double *corr, double *err);
 
-/* System driver to schedule leap second */
-typedef void (*lcl_SetLeapDriver)(int leap);
+/* System driver to schedule leap seconds and set TAI-UTC offset */
+typedef void (*lcl_SetLeapDriver)(int leap, int tai_offset);
 
 /* System driver to set the synchronisation status */
 typedef void (*lcl_SetSyncStatusDriver)(int synchronised, double est_error, double max_error);
index d5c049f0d8744c816ce1e1635c2487fd9234af9a..aa151d1d51677a06a779dc0a18c5b83226ccb582 100644 (file)
@@ -678,7 +678,7 @@ leap_end_timeout(void *arg)
   our_leap_sec = 0;
 
   if (leap_mode == REF_LeapModeSystem)
-    LCL_SetSystemLeap(0);
+    LCL_SetSystemLeap(our_leap_sec, 0);
 
   if (our_leap_status == LEAP_InsertSecond ||
       our_leap_status == LEAP_DeleteSecond)
@@ -778,7 +778,7 @@ update_leap_status(NTP_Leap leap, time_t now, int reset)
 
     switch (leap_mode) {
       case REF_LeapModeSystem:
-        LCL_SetSystemLeap(our_leap_sec);
+        LCL_SetSystemLeap(our_leap_sec, 0);
         /* Fall through */
       case REF_LeapModeSlew:
       case REF_LeapModeStep:
index d50bf2639782009f739dd30f685cdc966e9040a4..aa273cd36f747b98da665bcf3798fc98807530fc 100644 (file)
@@ -95,7 +95,7 @@ set_frequency(double freq_ppm)
 /* ================================================== */
 
 static void
-set_leap(int leap)
+set_leap(int leap, int tai_offset)
 {
   struct timex txc;
   int applied;