Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(functions.lua) Change os.time() to os.clock() #1135

Closed
wants to merge 1 commit into from
Closed

fix(functions.lua) Change os.time() to os.clock() #1135

wants to merge 1 commit into from

Conversation

epyidev
Copy link
Contributor

@epyidev epyidev commented Jul 28, 2023

os.time() returns the unix time but only seconds which is not very accurate. Better to use os.clock() which returns milliseconds.

os.time() returns the unix time but only seconds which is not very accurate. Better to use os.clock() which returns milliseconds.
@Gellipapa
Copy link
Contributor

@epyidev Hi! Thank you for pr and suggestion.

Explanation:
os.clock() measures the computer's processor time, while os.time() returns the actual time. In this case, we're looking for the real time, how long it took to save the players. Not how much computer processor time it took to save the players. So the fact that we are looking for the real time means that os.time() is implemented and used correctly.

os.clock() is used where we want to look at the performance of say an algorithm or method, where accuracy is very important but for a player save it doesn't matter, so it's fine if there's a difference between the two, which will be very small if there is, so we stick with the real time, os.time().

@Gellipapa Gellipapa closed this Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants