Skip to content

__archive_fetch from/until intervals rounding #230

@albertored

Description

@albertored

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions