local: add support for setting TAI-UTC offset

This commit is contained in:
Miroslav Lichvar 2017-06-29 15:14:16 +02:00
parent 5d838729ef
commit a768578a26
5 changed files with 12 additions and 11 deletions

View file

@ -700,10 +700,10 @@ LCL_CanSystemLeap(void)
/* ================================================== */ /* ================================================== */
void void
LCL_SetSystemLeap(int leap) LCL_SetSystemLeap(int leap, int tai_offset)
{ {
if (drv_set_leap) { if (drv_set_leap) {
(drv_set_leap)(leap); (drv_set_leap)(leap, tai_offset);
} }
} }

View file

@ -201,10 +201,11 @@ extern int LCL_MakeStep(void);
does something */ does something */
extern int LCL_CanSystemLeap(void); extern int LCL_CanSystemLeap(void);
/* Routine to set the system clock to correct itself for a leap second if /* Routine to set the system clock to correct itself for a leap second and also
supported. Leap second will be inserted at the end of the day if the set its TAI-UTC offset. If supported, leap second will be inserted at the
argument is positive, deleted if negative, and zero resets the setting. */ end of the day if the argument is positive, deleted if negative, and zero
extern void LCL_SetSystemLeap(int leap); resets the setting. */
extern void LCL_SetSystemLeap(int leap, int tai_offset);
/* Routine to set a frequency correction (in ppm) that should be applied /* Routine to set a frequency correction (in ppm) that should be applied
to local clock to compensate for temperature changes. A positive to local clock to compensate for temperature changes. A positive

View file

@ -54,8 +54,8 @@ typedef int (*lcl_ApplyStepOffsetDriver)(double offset);
raw time to get the corrected time */ raw time to get the corrected time */
typedef void (*lcl_OffsetCorrectionDriver)(struct timespec *raw, double *corr, double *err); typedef void (*lcl_OffsetCorrectionDriver)(struct timespec *raw, double *corr, double *err);
/* System driver to schedule leap second */ /* System driver to schedule leap seconds and set TAI-UTC offset */
typedef void (*lcl_SetLeapDriver)(int leap); typedef void (*lcl_SetLeapDriver)(int leap, int tai_offset);
/* System driver to set the synchronisation status */ /* System driver to set the synchronisation status */
typedef void (*lcl_SetSyncStatusDriver)(int synchronised, double est_error, double max_error); typedef void (*lcl_SetSyncStatusDriver)(int synchronised, double est_error, double max_error);

View file

@ -678,7 +678,7 @@ leap_end_timeout(void *arg)
our_leap_sec = 0; our_leap_sec = 0;
if (leap_mode == REF_LeapModeSystem) if (leap_mode == REF_LeapModeSystem)
LCL_SetSystemLeap(0); LCL_SetSystemLeap(our_leap_sec, 0);
if (our_leap_status == LEAP_InsertSecond || if (our_leap_status == LEAP_InsertSecond ||
our_leap_status == LEAP_DeleteSecond) our_leap_status == LEAP_DeleteSecond)
@ -778,7 +778,7 @@ update_leap_status(NTP_Leap leap, time_t now, int reset)
switch (leap_mode) { switch (leap_mode) {
case REF_LeapModeSystem: case REF_LeapModeSystem:
LCL_SetSystemLeap(our_leap_sec); LCL_SetSystemLeap(our_leap_sec, 0);
/* Fall through */ /* Fall through */
case REF_LeapModeSlew: case REF_LeapModeSlew:
case REF_LeapModeStep: case REF_LeapModeStep:

View file

@ -95,7 +95,7 @@ set_frequency(double freq_ppm)
/* ================================================== */ /* ================================================== */
static void static void
set_leap(int leap) set_leap(int leap, int tai_offset)
{ {
struct timex txc; struct timex txc;
int applied; int applied;