[fluksod] determine threshold based on current unix time
This commit is contained in:
parent
5defc5b906
commit
e41aa35ccc
|
@ -141,7 +141,7 @@ end
|
||||||
function wan_buffer(child)
|
function wan_buffer(child)
|
||||||
return coroutine.create(function(sensor_id, timestamp, counter)
|
return coroutine.create(function(sensor_id, timestamp, counter)
|
||||||
local measurements = data.new()
|
local measurements = data.new()
|
||||||
local threshold = timestamp + WAN_INTERVAL
|
local threshold = os.time() + WAN_INTERVAL
|
||||||
local previous = {}
|
local previous = {}
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
|
@ -166,7 +166,7 @@ function wan_buffer(child)
|
||||||
|
|
||||||
if timestamp > threshold and next(measurements) then --checking whether table is not empty
|
if timestamp > threshold and next(measurements) then --checking whether table is not empty
|
||||||
coroutine.resume(child, measurements)
|
coroutine.resume(child, measurements)
|
||||||
threshold = timestamp + WAN_INTERVAL
|
threshold = os.time() + WAN_INTERVAL
|
||||||
end
|
end
|
||||||
|
|
||||||
sensor_id, timestamp, counter = coroutine.yield()
|
sensor_id, timestamp, counter = coroutine.yield()
|
||||||
|
|
Loading…
Reference in New Issue