moved millis_to_nano in influxdb.py
This commit is contained in:
@@ -472,7 +472,7 @@ class InfluxDataGetter:
|
||||
variable (str) : the name (Influx) of the variable we want the values of.
|
||||
parameter (str) : the parameter of the variable to get the values from
|
||||
time ([(int)]) : the timerange we want the values in. It consists of two values which are Unix timestamps in seconds, first included, second excluded.
|
||||
interval (int) : the interval (resolution) of the values to get (in nanoseconds)
|
||||
interval (int) : the interval (resolution) of the values to get (in milliseconds)
|
||||
|
||||
Returns :
|
||||
[[(int), (float)]] : an array of pairs (also arrays), the first value being the Unix timestamp in second (x), the seconds being the value (y)
|
||||
@@ -483,7 +483,7 @@ class InfluxDataGetter:
|
||||
|> range(start: {time[0]}, stop: {time[1] + 1})
|
||||
|> filter(fn : (r) => r._measurement == "{variable}")
|
||||
|> filter(fn : (r) => r._field == "{parameter+"_float"}")
|
||||
{"|> aggregateWindow(every: duration(v:"+str(interval)+"), fn: last, createEmpty:false, timeDst:"+chr(34)+"binning_time"+chr(34)+")" if interval else ""}
|
||||
{"|> aggregateWindow(every: duration(v:"+str(self._milliseconds_to_nanoseconds(interval))+"), fn: last, createEmpty:false, timeDst:"+chr(34)+"binning_time"+chr(34)+")" if interval else ""}
|
||||
|> keep(columns: ["_time","_value","expired"{", "+chr(34)+"binning_time"+chr(34) if interval else ""}])
|
||||
|> yield(name: "res")
|
||||
"""
|
||||
@@ -648,4 +648,7 @@ class InfluxDataGetter:
|
||||
return res
|
||||
|
||||
def _seconds_to_nanoseconds(self, seconds):
|
||||
return seconds * 1000000000
|
||||
return seconds * 1000000000
|
||||
|
||||
def _milliseconds_to_nanoseconds(self, milliseconds):
|
||||
return milliseconds * 1000000
|
||||
Reference in New Issue
Block a user