-
Notifications
You must be signed in to change notification settings - Fork 2k
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
mainmenu: Fix minetest.after timing #4003
Conversation
7cbe327
to
dc05e27
Compare
👍 |
os.clock is unreliable, you can't use it for testing the timer. use minetest.get_us_time() instead |
I've spent a few nights to make sure that the current code was in order and tested with thousands of timers etc.. I'll review this since I don't want it to regress to the bad timer performance we had before ad884f2 |
NVM, I see what's going on here. Yes, this is entirely right, thanks for spotting this edge-case.
|
This seems like a better solution:
|
@sofar Depends what time matters. Either it's the time when Lua loads the scripts or after it loaded all and begins to call the global functions. |
I'd prefer the time initialization method as it removes an entire branch. |
88f213d
to
f8c2598
Compare
My suggested fix (proper initialization) is in #4009 |
f8c2598
to
7705099
Compare
This fixes the problem that the first timer tick is an overrun and causes all timers to expire immediately. replaces #4003
#4009 is merged. |
Returns
This function was called after 7.0620000000001s
,This function was called after 0.45299999999997s
or any other value.This bug was caused by the time calculation of the time
last
, which is initialized to zero. The timenew
instead starts with any value.Tested this pull and got
This function was called after 10.469s
(some loading delay included).