]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
rtc: move preinit call to RTC_Initialise()
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 18 Aug 2014 09:25:16 +0000 (11:25 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 19 Aug 2014 08:46:32 +0000 (10:46 +0200)
main.c
rtc.c
rtc.h

diff --git a/main.c b/main.c
index 4b11dc4c20573d29b7266b4775176ee2034f1a3e..868cb7f904af91725ceb5e61aa339f032fd5e0b8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -452,16 +452,12 @@ int main
    * be done *AFTER* the daemon-creation fork() */
   write_lockfile();
 
-  if (do_init_rtc) {
-    RTC_TimePreInit();
-  }
-
   LCL_Initialise();
   SCH_Initialise();
   SYS_Initialise();
   NIO_Initialise(address_family);
   CAM_Initialise(address_family);
-  RTC_Initialise();
+  RTC_Initialise(do_init_rtc);
   SRC_Initialise();
   RCL_Initialise();
   KEY_Initialise();
diff --git a/rtc.c b/rtc.c
index 5b2ccf99959012cdd9195820e9d340dceac4d8a6..90828d0f12bd4a0417b28273d04bcc52e4495fe7 100644 (file)
--- a/rtc.c
+++ b/rtc.c
@@ -74,10 +74,16 @@ static struct {
 /* ================================================== */
 
 void
-RTC_Initialise(void)
+RTC_Initialise(int initial_set)
 {
   char *file_name;
 
+  /* Do an initial read of the RTC and set the system time to it.  This
+     is analogous to what /sbin/hwclock -s would do on Linux. */
+  if (initial_set && driver.time_pre_init) {
+    (driver.time_pre_init)();
+  }
+
   driver_initialised = 0;
 
   /* This is how we tell whether the user wants to load the RTC
@@ -130,18 +136,6 @@ RTC_TimeInit(void (*after_hook)(void *), void *anything)
   }
 }
 
-/* ================================================== */
-/* Do an initial read of the RTC and set the system time to it.  This
-   is analogous to what /sbin/hwclock -s would do on Linux. */
-
-void
-RTC_TimePreInit(void)
-{
-  if (driver.time_pre_init) {
-    (driver.time_pre_init)();
-  }
-}
-
 /* ================================================== */
 /* Start the RTC measurement process */
 
diff --git a/rtc.h b/rtc.h
index da60bc76d5f8960e5869dc5189d6673712dfa51b..8fd677be2776bdc4c2f8e9502fb4a45e767a1da1 100644 (file)
--- a/rtc.h
+++ b/rtc.h
@@ -28,9 +28,8 @@
 
 #include "reports.h"
 
-extern void RTC_Initialise(void);
+extern void RTC_Initialise(int initial_set);
 extern void RTC_Finalise(void);
-extern void RTC_TimePreInit(void);
 extern void RTC_TimeInit(void (*after_hook)(void *), void *anything);
 extern void RTC_StartMeasurements(void);
 extern int  RTC_GetReport(RPT_RTC_Report *report);