From 5f516e2fed23abd210edb868faf6882b00f33c7d Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Mon, 19 Apr 2010 23:53:07 +0200 Subject: [PATCH] when multiple pulses per second are received for a single sensor, rrdtool will reject the new series of measurements: minimum one second step. introduce a fix in the Flukso daemon --- openwrt/package/flukso/src/flukso.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openwrt/package/flukso/src/flukso.lua b/openwrt/package/flukso/src/flukso.lua index 9bdea33..a88c8c6 100755 --- a/openwrt/package/flukso/src/flukso.lua +++ b/openwrt/package/flukso/src/flukso.lua @@ -79,12 +79,14 @@ function buffer(child, interval) return coroutine.create(function(meter, timestamp, value) local measurements = data.new() local threshold = os.time() + interval + local old_timestamp = 0 while true do - if meter ~= nil and timestamp > 1234567890 then measurements:add(meter, timestamp, value) end + if meter ~= nil and timestamp > math.max(1234567890, old_timestamp) then measurements:add(meter, timestamp, value) end if timestamp > threshold and next(measurements) then --checking whether table is not empty coroutine.resume(child, measurements) threshold = timestamp + interval + old_timestamp = timestamp end meter, timestamp, value = coroutine.yield() end