reference: use step leap mode by default if system is not supported

This commit is contained in:
Miroslav Lichvar 2015-03-25 13:08:56 +01:00
parent bb21841659
commit 802a98e7fc
3 changed files with 15 additions and 0 deletions

View file

@ -612,6 +612,14 @@ LCL_MakeStep(void)
/* ================================================== */ /* ================================================== */
int
LCL_CanSystemLeap(void)
{
return drv_set_leap ? 1 : 0;
}
/* ================================================== */
void void
LCL_SetSystemLeap(int leap) LCL_SetSystemLeap(int leap)
{ {

View file

@ -198,6 +198,10 @@ extern void LCL_Finalise(void);
to a timezone problem. */ to a timezone problem. */
extern int LCL_MakeStep(void); 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 /* 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 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. */ argument is positive, deleted if negative, and zero resets the setting. */

View file

@ -240,6 +240,9 @@ REF_Initialise(void)
leap_timer_running = 0; leap_timer_running = 0;
leap_in_progress = 0; leap_in_progress = 0;
leap_mode = CNF_GetLeapSecMode(); 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(); leap_tzname = CNF_GetLeapSecTimezone();
if (leap_tzname) { if (leap_tzname) {