This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Time to switch from "false" to "true"!
#1
Hi everybody ! I have a little trouble? Hope everybody help please:

-My address changes from "false" to "true", it needs to be 1.254s. I see it in the "Update at" section. How do I know that time? I want to do something with this "1,254s".

Thank so much everybody !

Attached Files Thumbnail(s)
   
Reply
#2
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
Reply


Forum Jump: