11.11.2019, 08:23
delta variable will have the time between FALSE and TRUE values in seconds.
Code:
value = event.getvalue()
if value then
prevtime = storage.get('prevtime')
if prevtime then
storage.delete('prevtime')
delta = os.udifftime(unpack(prevtime))
log(delta)
end
else
storage.set('prevtime', { os.microtime() })
end