01.01.2023, 18:31
(This post was last modified: 01.01.2023, 18:53 by nmedalacabeza.)
Code:
--------------------------------------------------------------------------
value = event.getvalue()
key_curr = 'ontime_curr'
out_curr = '33/1/31'
key_total = 'ontime_total'
out_total = '33/1/30'
time = storage.get(key_curr)
now = os.time()
if value then
if not time then
storage.set(key_curr, now)
formattime(out_curr, 0)
end
else
if time then
time_total = storage.exec('incrby', key_total, now - time)
formattime(out_total, time_total)
storage.delete(key_curr)
end
grp.update(out_curr, '')
end
---- ---- resident-------------------------------
key_curr = 'ontime_curr'
out_curr = '33/1/31'
key_total = 'ontime_total'
out_total = '33/1/30'
time_curr = storage.get(key_curr)
if time_curr then
time_curr = os.time() - time_curr
formattime(out_curr, time_curr)
time_total = storage.get(key_total, 0)
formattime(out_total, time_total - time_curr) -- negative placement
end
Hello, it counts backwards but it doesn't keep the value that I have wrong? Could you put the hours to be subtracted in a group address?
Thank you