remove timestamp wrapper func

This commit is contained in:
Yannik Schmidt
2020-08-16 15:43:35 +02:00
parent 470fdccffd
commit f8e94ad36a
3 changed files with 5 additions and 8 deletions

View File

@@ -39,11 +39,11 @@ def legend_box_contents(name, y):
def general_background_setup(tup,ymin,ymax,x): def general_background_setup(tup,ymin,ymax,x):
unix_x = list(map(plot_timeutils.unix,x)) unix_x = [ el.timestamp() for el in x ]
### SET AXIS LIMITS ### ### SET AXIS LIMITS ###
tup[AXIS].set_ylim([ymin,ymax]) tup[AXIS].set_ylim( [ ymin, ymax ] )
tup[AXIS].set_xlim([plot_timeutils.unix(min(x)),plot_timeutils.unix(max(x))]) tup[AXIS].set_xlim( [ min(x).timestamp(), max(x).timestamp() ] )
if CFG("draw_thresholds"): if CFG("draw_thresholds"):
hcrit=CFG("humidity_critical") hcrit=CFG("humidity_critical")
@@ -223,7 +223,7 @@ def gen_xticks_from_timeseries(x):
xticks = [] xticks = []
xmax += step*CFG("add_x_labels_at_end") xmax += step*CFG("add_x_labels_at_end")
while cur < xmax: while cur < xmax:
xticks += [plot_timeutils.unix(cur)] xticks += [cur.timestamp()]
cur+=step cur+=step
return xticks return xticks

View File

@@ -44,7 +44,7 @@ def __plot(tup, datapoints, path, date1=None, date2=None, forcePath=False):
continue continue
else: else:
NO_SERIES = False NO_SERIES = False
unix_x = list(map(plot_timeutils.unix,x)) unix_x = [ el.timestamp() for el in x]
ymin,ymax = plot_graphutils.getlimits_y(y) ymin,ymax = plot_graphutils.getlimits_y(y)
#### GET LINE STYLES #### #### GET LINE STYLES ####

View File

@@ -18,9 +18,6 @@ def time_from_dbf(l, timeformat):
def time_from_csv(l, timeformat): def time_from_csv(l, timeformat):
return datetime.strptime(l, timeformat) return datetime.strptime(l, timeformat)
def unix(dt):
return dt.timestamp()
def round_time_to_step(start,step): def round_time_to_step(start,step):
start += step / 2 start += step / 2
discard = timedelta(days=0) discard = timedelta(days=0)