moved millis_to_nano in influxdb.py

This commit is contained in:
l_samenv
2024-08-30 09:35:21 +02:00
parent 83e22a2e9f
commit 94424bd422
2 changed files with 8 additions and 14 deletions

View File

@ -34,15 +34,6 @@ class InfluxGraph:
self.lastvalues = {}
self.variables = {} # name:label
def milliseconds_to_nano(self, milliseconds):
"""
Converts milliseconds to nanoseconds
Parameters:
milliseconds (int)
Returns :
int
"""
return milliseconds*1000000
def get_abs_time(self, times):
"""
@ -83,7 +74,7 @@ class InfluxGraph:
Parameters :
variables (str) : a comma separataed value string of variable names (influx names) to retrieve
time (str) : a commma separated value string (range) of seconds. They are treated as relative from now if they are lesser than one year.
interval (str) : the interval (resolution) of the values to get (string in seconds)
interval (str) : the interval (resolution) of the values to get (string in milliseconds)
Returns :
{"type":"graph-draw", "reduced":(bool), "graph":{(str):[[(int),(float)]]}} : a dictionnary with its "graph-draw" type (so it can be processed by the client), a "reduced" value
@ -97,7 +88,7 @@ class InfluxGraph:
queried_variables = variables.split(',')
self.livemode = self.ACTUAL if end+10 >= now else self.HISTORICAL
logging.info('LIVE %g %g %d %d', end, now, end >= now, self.livemode)
if interval : interval = self.milliseconds_to_nano(int(interval))
if interval : interval = int(interval)
result = self.influx_data_getter.get_curves_in_timerange(queried_variables, queried_time_range, interval)
self.complete_to_end(result, min(end, now))