in otava/util.py [0:0]
def resolution(time: List[int]) -> int:
"""
Graphite has a finite time resolution and the timestamps are rounded
to e.g. full days. This function tries to automatically detect the
level of rounding needed by inspecting the minimum time distance between the
data points.
"""
res = 24 * 3600
if len(time) < 2:
return res
for (a, b) in sliding_window(time, 2):
if b - a > 0:
res = min(res, b - a)
for t in time:
res = math.gcd(res, t)
return res