Code: Select all
function seconds_to_clock( seconds )
local seconds = tonumber( seconds )
if seconds <= 0 then
return '00:00:00'
else
local hours = string.format( '%02.f', math.floor( seconds / 3600 ) )
local minutes = string.format( '%02.f', math.floor( seconds / 60 - ( hours * 60 ) ) )
seconds = string.format( '%02.f', math.floor( seconds - hours * 3600 - minutes * 60 ) )
return hours .. ':' .. minutes .. ':' .. seconds
end
end