Library of Functions


Description


Retrieves the ‘time last modified’ of a global variable registered in the Variables Panel.
 
This is one of a group of functions:
  • fibaro:getGlobal
  • fibaro:getGlobalValue
  • fibaro:getGlobalModificationTime
 
These functions differ only in their return value.

Usage and Arguments


fibaro:getGlobalModificationTime(varName)

  • varName: the name of the global variable

Returned Values


A timestamp of when the global variable was last modified.

Please note that this return value is of type string.  When comparing it with a variable of type number, use tonumber to convert it first.

Examples


-- Get the last modification time of the 'counter' global variable
local lastModified = fibaro:getGlobalModificationTime('counter')
 
-- If it's been at least 10 seconds since the value was last modified
if ((os.time() - lastModified) >= 10) then
  fibaro:debug('It has been 10 seconds or more')
else
  fibaro:debug('It has been less than 10 seconds')
end

See Also


fibaro:getGlobal

fibaro:getGlobalValue