diff --git a/local.c b/local.c index e5ac43f..b4baaac 100644 --- 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 618a0bd..7ceb76a 100644 --- 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 diff --git a/localp.h b/localp.h index fbbeb3e..6f65e43 100644 --- 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); diff --git a/reference.c b/reference.c index d5c049f..aa151d1 100644 --- a/reference.c +++ b/reference.c @@ -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: diff --git a/sys_timex.c b/sys_timex.c index d50bf26..aa273cd 100644 --- a/sys_timex.c +++ b/sys_timex.c @@ -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;