1
Mach4 General Discussion / Re: Convert millisecond to time
« on: December 22, 2023, 10:29:29 AM »
Thanks it work perfectly.
Code: [Select]
-------------------------------------------------------
-- Machine up time
-------------------------------------------------------
local Milliseconds = mc.mcCntlGetPoundVar(inst, 3001 )
local seconds = string.format("%02.f", math.floor(Milliseconds/1000))
if seconds == 0 then
scr.SetProperty("Machineuptime", "Label", "00:00:00")
else
local hours = string.format("%02.f", math.floor(seconds/3600))
local mins = string.format("%02.f", math.floor((seconds/60) - (hours*60)))
local secs = string.format("%02.0f",(seconds - (hours*3600) - (mins*60)))
scr.SetProperty("Machineuptime", "Label", hours ..":" ..mins ..":".. secs)
end