diff --git a/local.c b/local.c index 8715782..6c337b2 100644 --- a/local.c +++ b/local.c @@ -612,6 +612,14 @@ LCL_MakeStep(void) /* ================================================== */ +int +LCL_CanSystemLeap(void) +{ + return drv_set_leap ? 1 : 0; +} + +/* ================================================== */ + void LCL_SetSystemLeap(int leap) { diff --git a/local.h b/local.h index 2b17114..412b386 100644 --- a/local.h +++ b/local.h @@ -198,6 +198,10 @@ extern void LCL_Finalise(void); to a timezone problem. */ extern int LCL_MakeStep(void); +/* Check if the system driver supports leap seconds, i.e. LCL_SetSystemLeap + 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. */ diff --git a/reference.c b/reference.c index 86208e5..0b7c894 100644 --- a/reference.c +++ b/reference.c @@ -240,6 +240,9 @@ REF_Initialise(void) leap_timer_running = 0; leap_in_progress = 0; leap_mode = CNF_GetLeapSecMode(); + /* Switch to step mode if the system driver doesn't support leap */ + if (leap_mode == REF_LeapModeSystem && !LCL_CanSystemLeap()) + leap_mode = REF_LeapModeStep; leap_tzname = CNF_GetLeapSecTimezone(); if (leap_tzname) {