diff --git a/bin/weewx/wxengine.py b/bin/weewx/wxengine.py index 11fc6e2e..6bac4fa7 100644 --- a/bin/weewx/wxengine.py +++ b/bin/weewx/wxengine.py @@ -588,9 +588,18 @@ class StdTimeSynch(StdService): self.clock_check = int(config_dict['Station'].get('clock_check', 14400)) self.max_drift = int(config_dict['Station'].get('max_drift', 5)) + self.bind(weewx.STARTUP, self.startup) self.bind(weewx.PRE_LOOP, self.pre_loop) + + def startup(self, event): + """Called when the engine is starting up.""" + self.do_sync() def pre_loop(self, event): + """Called before the main event loop is started.""" + self.do_sync() + + def do_sync(self): """Ask the station to synch up if enough time has passed.""" # Synch up the station's clock if it's been more than clock_check # seconds since the last check: diff --git a/docs/changes.txt b/docs/changes.txt index 9bc1906d..38077e76 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,6 +1,13 @@ weewx change history -------------------- +2.3.4 07/XX/13 + +The service StdTimeSync now catches startup events and syncs the clock +on them. It has now been moved to the beginning of the list "service_list" +in weewx.conf. Users may want to do the same with their configuration file. + + 2.3.3 06/21/13 The option week_start now works. diff --git a/docs/upgrading.htm b/docs/upgrading.htm index e4e12626..0beb547e 100644 --- a/docs/upgrading.htm +++ b/docs/upgrading.htm @@ -134,6 +134,20 @@ Version: 2.3.3
warning: /etc/weewx/weewx.conf created as /etc/weewx/weewx.conf.rpmnew
The service StdTimeSync now synchronizes the + console's onboard clock on startup. This is nice because if the clock + failed, perhaps because the battery was taken out, the time is corrected + first before data is downloaded from the logger's memory. To take + advantage of this, you can move service StdTimeSync + to the front of the list of services to be run:
+ [[WxEngine]]
+ # The list of services the main weewx engine should run:
+ service_list = weewx.wxengine.StdTimeSynch,
+ weewx.wxengine.StdConvert, weewx.wxengine.StdCalibrate,
+ weewx.wxengine.StdQC, weewx.wxengine.StdArchive, weewx.wxengine.StdPrint,
+ weewx.wxengine.StdRESTful, weewx.wxengine.StdReport
+
The option time_length will now be the exact length of the resultant plot. Before, a plot with diff --git a/weewx.conf b/weewx.conf index 67f487df..09404d37 100644 --- a/weewx.conf +++ b/weewx.conf @@ -529,4 +529,4 @@ version = 2.3.3 [[WxEngine]] # The list of services the main weewx engine should run: - service_list = weewx.wxengine.StdConvert, weewx.wxengine.StdCalibrate, weewx.wxengine.StdQC, weewx.wxengine.StdArchive, weewx.wxengine.StdTimeSynch, weewx.wxengine.StdPrint, weewx.wxengine.StdRESTful, weewx.wxengine.StdReport + service_list = weewx.wxengine.StdTimeSynch, weewx.wxengine.StdConvert, weewx.wxengine.StdCalibrate, weewx.wxengine.StdQC, weewx.wxengine.StdArchive, weewx.wxengine.StdPrint, weewx.wxengine.StdRESTful, weewx.wxengine.StdReport