]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
reference: use step leap mode by default if system is not supported
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 25 Mar 2015 12:08:56 +0000 (13:08 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 27 Mar 2015 09:37:54 +0000 (10:37 +0100)
local.c
local.h
reference.c

diff --git a/local.c b/local.c
index 8715782a23b639cf9006c54f25ac853063826c1f..6c337b2f6fadad103f0cfea3c3c0a98dca5f8ea0 100644 (file)
--- 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 2b17114bafc69845c312fb0b11917b4fcb757557..412b386612a7bab4a609c25e6548366fa90e5a3d 100644 (file)
--- 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. */
index 86208e5681a004f542eac05964826f65ce605fd7..0b7c894e9866fd1d7db725c5d02e477aa091ab3e 100644 (file)
@@ -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) {