Closed beatriznunez closed 4 years ago
>>> timestamp = 1597939978
>>> datetime.utcfromtimestamp(int(timestamp) / 1000)
datetime.datetime(1970, 1, 19, 11, 52, 19, 978000)
>>> datetime.utcfromtimestamp(int(timestamp))
datetime.datetime(2020, 8, 20, 16, 12, 58)
You are correct that I am dividing the UTC timestamp by 1000:
I was doing this previously because the docs stated that the UTC stamp had millisecond precision. I guess at some point they changed that. Luckily, this is a simple fix.
Okay, so the last_seen
value from the sensor does not have millisecond precision (i.e. 1601557479
), but the one in the Statistics field does (i.e. 1601557442965
). I will push a new build shortly.
The new build is now available in PyPI. Please update with pip install --upgrade purpleair
.
Thanks for the package Christopher.
I have just started using it and it seems that there is an issue while parsing dates: