Skip to content

Commit

Permalink
fix(functions.lua) Change os.time() to os.clock()
Browse files Browse the repository at this point in the history
os.time() returns the unix time but only seconds which is not very accurate. Better to use os.clock() which returns milliseconds.
  • Loading branch information
epyidev committed Jul 28, 2023
1 parent 7fc8198 commit dd8c48c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions [core]/es_extended/server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function Core.SavePlayers(cb)
return
end

local startTime <const> = os.time()
local startTime <const> = os.clock()
local parameters = {}

for _, xPlayer in pairs(ESX.Players) do
Expand Down Expand Up @@ -220,7 +220,7 @@ function Core.SavePlayers(cb)
return cb()
end

print(('[^2INFO^7] Saved ^5%s^7 %s over ^5%s^7 ms'):format(#parameters, #parameters > 1 and 'players' or 'player', ESX.Math.Round((os.time() - startTime) / 1000000, 2)))
print(('[^2INFO^7] Saved ^5%s^7 %s over ^5%s^7 ms'):format(#parameters, #parameters > 1 and 'players' or 'player', ESX.Math.Round((os.clock() - startTime) * 1000, 2)))
end
)
end
Expand Down

0 comments on commit dd8c48c

Please sign in to comment.