-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChainAPI shouldn't fall back to local time #90
Comments
I think I found the issue. The script that posts the data from the atrium sensors uses my chainpost.py wrapper to look up the devices and metrics and post the data. The latest version is 0.4, but the version installed on the doppeldb.media server is 0.1. 0.4's timestamp logic: if timestamp is None:
timestamp = datetime.datetime.utcnow()
tzoffset = "+00:00"
sensor = self.find_sensor(dev_name, metric, unit)
if tzoffset is not None:
ts_str = timestamp.isoformat() + tzoffset
else:
ts_str = timestamp.isoformat()
sensor_data = dict(
value=value,
timestamp=ts_str
) Somewhat messy, but in the end In version 0.1, the same logic is followed for assigning sensor_data = dict(
value=value,
timestamp=timestamp.isoformat()
) This leads to a request being sent to Chain with a UTC timestamp with no offset specified, which Chain treats as a local time. 2018-03-11 02:34:33+00:00 is a valid timestamp, 2018-03-11 02:34:33 is not if it's assumed to be a local time and the local timezone observes current US DST rules. I just updated chainclient and chainpost on doppeldb.media to the latest versions. This does unfortunately mean that all exisisting data from the atrium sensors is probably offset by 4 or 5 hours depending on the time of year. |
OK - I'm renaming the issue to reflect the underlying bad behavior, which is that ChainAPI shouldn't interpret timestamps without time zones as in its own local time. It seems like either treating them as UTC time or just being strict and requiring the time zone suffix would both be pretty reasonable behaviors. |
Looks like we still have some kind of time-zone problem. This is somewhat different from #62, where the issue was the ambiguity converting local to UTC in the fall. In this issue somehow we're getting a time that doesn't actually exist.
@bmayton do the tidpost scripts post in UTC or local time?
The text was updated successfully, but these errors were encountered: