Elapsed time from Rocket Rush
Posted: Thu Mar 05, 2020 11:51 am
The scenario is about time, only it is annoying to have to enter the command /time all the time, so it would be nice if the following function is shown in the header.
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