Service StdTimeSync now does a clock sync on startup.

Modified service_list to put it at the front of the list of services to be run.
This commit is contained in:
Tom Keffer
2013-07-07 15:37:26 +00:00
parent 0683bbacee
commit ab42762711
4 changed files with 31 additions and 1 deletions

View File

@@ -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:

View File

@@ -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.

View File

@@ -134,6 +134,20 @@ Version: 2.3.3
<p class='tty'>warning: /etc/weewx/weewx.conf created as /etc/weewx/weewx.conf.rpmnew</p>
<h1><a name="Instructions_for_specific_versions">Instructions for specific versions</a></h1>
<h2>V2.3.3 or earlier</h2>
<p>The service <span class="code">StdTimeSync</span> 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 <em>before</em> data is downloaded from the logger's memory. To take
advantage of this, you can move service <span class="code">StdTimeSync</span>
to the front of the list of services to be run:</p>
<p class="tty">&nbsp;[[WxEngine]]<br />
# The list of services the main weewx engine should run:<br />
service_list = <span class="highlight">weewx.wxengine.StdTimeSynch</span>,
weewx.wxengine.StdConvert, weewx.wxengine.StdCalibrate,
weewx.wxengine.StdQC, weewx.wxengine.StdArchive, weewx.wxengine.StdPrint,
weewx.wxengine.StdRESTful, weewx.wxengine.StdReport<br />
</p>
<h2>V2.3 or earlier</h2>
<p>The option <span class="code">time_length</span> will now be the exact
length of the resultant plot. Before, a plot with <span class="code">

View File

@@ -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