Commit 364e3078 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

history: normalize insertion dates from the db to utc

Since straight out of the db we only get an offset,
and the utc timezone is quite implicit. We want it to be explicit
since pandas can change it interpretation from version to version
(e.g. .23 to .24 in a .loc in the presence of a datetime with offset
but no tz).

(we know it is utc because:

 * postgres is configured (see conftest) to UTC
 * we insert as utc
parent 190805d2ab21
......@@ -222,6 +222,11 @@ class timeseries(SeriesServices):
if not revs:
return {}
revs = [
(csid, pd.Timestamp(idate).astimezone('UTC'))
for csid, idate in revs
if diffmode:
# compute the previous serie value
first_csid = revs[0][0]
......@@ -270,10 +275,7 @@ class timeseries(SeriesServices):
for idate, ts in series
return {
pd.Timestamp(idate).astimezone('UTC'): serie
for idate, serie in series
return dict(series)
def staircase(self, cn, seriename, delta,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment