[ST Edge] Is there a way for a driver to get the current time?

Is there a way for an Edge driver to get the current time (without calling outside the hub)?

Haven’t tried it, but doesn’t this work?

local current_unix_timestamp = os.time()
print(current_unix_timestamp)
 
local current_date_time_string = os.date("%Y-%m-%d_%X", current_unix_timestamp)
print(current_date_time_string)
1 Like