diff --git a/seinflux.py b/seinflux.py index 027630e..bef772a 100644 --- a/seinflux.py +++ b/seinflux.py @@ -3,8 +3,12 @@ from pathlib import Path from configparser import ConfigParser from sehistory.influx import InfluxDBWrapper, abs_range, round_range, Table +ETERNITY = 1e10 + def fmtime(t): + if t >= ETERNITY: + return '-' * 19 return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(t))) @@ -261,7 +265,6 @@ class SEHistory(InfluxDBWrapper): interval = 1 gap = 600 - eternity = 1e10 if start is None: previous = {} else: @@ -331,9 +334,9 @@ class SEHistory(InfluxDBWrapper): if chunks and time.localtime(chunks[-1][0])[:3] == time.localtime(ts)[:3]: # merge when started at the same day chunk = chunks[-1][1] - chunk[1] = eternity + chunk[1] = ETERNITY else: - chunk = [ts, eternity] + chunk = [ts, ETERNITY] chunks.append(chunk) else: chunk = None