At the beginning of the function __archive_fetch here there is the following code that rounds from and until times to the granularity of the archive:
step = archive['secondsPerPoint']
fromInterval = int(fromTime - (fromTime % step)) + step
untilInterval = int(untilTime - (untilTime % step)) + step
I do not understand why after this rounding we add step to the result. This will give wrong results.
Take for instance:
fromTime = 1501639200 (02/08/2017 2:00 AM UTC)
untilTime = 1501660800 (02/08/2017 8:00 AM UTC)
with a step of 1 hour (that is step = 3660). In this case both fromTime % step and untilTime % step gives 0 as result but since step is then added we return a result for the range 02/08/2017 3:00 AM UTC -- 02/08/2017 9:00 AM UTC
At the beginning of the function
__archive_fetchhere there is the following code that rounds from and until times to the granularity of the archive:I do not understand why after this rounding we add
stepto the result. This will give wrong results.Take for instance:
fromTime = 1501639200(02/08/2017 2:00 AM UTC)untilTime = 1501660800(02/08/2017 8:00 AM UTC)with a step of 1 hour (that is
step = 3660). In this case bothfromTime % stepanduntilTime % stepgives 0 as result but sincestepis then added we return a result for the range 02/08/2017 3:00 AM UTC -- 02/08/2017 9:00 AM UTC