sehistory: export ETERNITY constant
This commit is contained in:
@ -3,8 +3,12 @@ from pathlib import Path
|
|||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from sehistory.influx import InfluxDBWrapper, abs_range, round_range, Table
|
from sehistory.influx import InfluxDBWrapper, abs_range, round_range, Table
|
||||||
|
|
||||||
|
ETERNITY = 1e10
|
||||||
|
|
||||||
|
|
||||||
def fmtime(t):
|
def fmtime(t):
|
||||||
|
if t >= ETERNITY:
|
||||||
|
return '-' * 19
|
||||||
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(t)))
|
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(t)))
|
||||||
|
|
||||||
|
|
||||||
@ -261,7 +265,6 @@ class SEHistory(InfluxDBWrapper):
|
|||||||
|
|
||||||
interval = 1
|
interval = 1
|
||||||
gap = 600
|
gap = 600
|
||||||
eternity = 1e10
|
|
||||||
if start is None:
|
if start is None:
|
||||||
previous = {}
|
previous = {}
|
||||||
else:
|
else:
|
||||||
@ -331,9 +334,9 @@ class SEHistory(InfluxDBWrapper):
|
|||||||
if chunks and time.localtime(chunks[-1][0])[:3] == time.localtime(ts)[:3]:
|
if chunks and time.localtime(chunks[-1][0])[:3] == time.localtime(ts)[:3]:
|
||||||
# merge when started at the same day
|
# merge when started at the same day
|
||||||
chunk = chunks[-1][1]
|
chunk = chunks[-1][1]
|
||||||
chunk[1] = eternity
|
chunk[1] = ETERNITY
|
||||||
else:
|
else:
|
||||||
chunk = [ts, eternity]
|
chunk = [ts, ETERNITY]
|
||||||
chunks.append(chunk)
|
chunks.append(chunk)
|
||||||
else:
|
else:
|
||||||
chunk = None
|
chunk = None
|
||||||
|
Reference in New Issue
Block a user