willmorrison1 / pixpy

Capture optris images and save to netcdf
0 stars 0 forks source link

time is UTC-1 #6

Open willmorrison1 opened 1 year ago

willmorrison1 commented 1 year ago

why?

willmorrison1 commented 2 months ago

Also reported that the time in the filename and the time in the file ahve 1 h difference. This is being checked to confirm if the time in the file is UTC

willmorrison1 commented 2 months ago

The various uses of datetime.utcnow() and datetime.timestamp() are not TZ aware and I think this caused issues. e.g.

https://github.com/willmorrison1/pixpy/blob/a234070c553131fd2c7fa92205c2830bf4b33f85/pixpy/app.py#L145

https://github.com/willmorrison1/pixpy/blob/a234070c553131fd2c7fa92205c2830bf4b33f85/pixpy/app.py#L170-L171

so this needs checking and fixing and needs TZ are datetimes i.e. as b not a

from datetime import datetime, timezone
a=datetime.utcnow(); b=datetime.now(timezone.utc)