Guard against a negative value for 'interval' in WMR200 stations.

This commit is contained in:
Tom Keffer
2018-09-15 05:48:46 -07:00
parent 07c274634b
commit ea9fe134a2
2 changed files with 8 additions and 1 deletions

View File

@@ -1943,7 +1943,12 @@ class WMR200(weewx.drivers.AbstractDevice):
timestamp_packet_interval = timestamp_packet_current \
- timestamp_packet_previous
if pkt.timestamp_record() > (timestamp_packet_previous
if timestamp_packet_interval < 0:
loginf(('genStartup() Discarding received archive record that presented out-of-order; '
'current timestamp:%s; previous timestamp:%s')
% (weeutil.weeutil.timestamp_to_string(timestamp_packet_current),
weeutil.weeutil.timestamp_to_string(timestamp_packet_previous)))
elif pkt.timestamp_record() > (timestamp_packet_previous
+ self._archive_threshold):
loginf(('genStartup() Discarding received archive'
' record exceeding archive interval cnt:%d'

View File

@@ -29,6 +29,8 @@ doing a merge to the new config file. Fixes issue #217.
Example xstats now includes tags for last_year and last_year_todate.
Thanks to user evilbunny2008. PR #325.
Guard against a negative value for 'interval' in WMR200 stations.
3.8.2 08/15/2018