Merge branch 'main' of https://github.com/sekta2/VoxelEngine-Cpp
This commit is contained in:
+16
-1
@@ -69,6 +69,21 @@ console.add_command(
|
||||
end
|
||||
)
|
||||
|
||||
local function FormattedTime(seconds, format ) -- from gmod
|
||||
if not seconds then seconds = 0 end
|
||||
|
||||
local hours = math.floor(seconds / 3600)
|
||||
local minutes = math.floor((seconds / 60) % 60)
|
||||
local millisecs = (seconds - math.floor(seconds)) * 100
|
||||
seconds = math.floor(seconds % 60)
|
||||
|
||||
if format then
|
||||
return string.format(format, minutes, seconds, millisecs)
|
||||
else
|
||||
return {h = hours, m = minutes, s = seconds, ms = millisecs}
|
||||
end
|
||||
end
|
||||
|
||||
console.add_command(
|
||||
"time.uptime",
|
||||
"Get time elapsed since the engine started",
|
||||
@@ -76,7 +91,7 @@ console.add_command(
|
||||
local uptime = time.uptime()
|
||||
local formatted_uptime = ""
|
||||
|
||||
local t = string.formatted_time(uptime)
|
||||
local t = FormattedTime(uptime)
|
||||
|
||||
formatted_uptime = t.h .. "h " .. t.m .. "m " .. t.s .. "s"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user