In my magical_realm modpack, I'm using playereffects effects to apply some effects to the player. playereffects, after applying an effect, calls minetest.after on a callback to cancel the effect, with the requested duration. Separately, the HUD of a player is updated on a globalstep, at intervals of one second. Usually, the HUD and effect cancellation are fairly in-sync, with the displayed time left going at most to a small negative number. But sometimes there are periods where the effect takes much longer to cancel, and the HUD continues to update, so that it might show -200 seconds left, for example.
I think I remember reading that minetest.after is also implemented using a globalstep callback. Why would the timing of the HUD and minetest.after action diverge so much?
Here is the effect in my code: https://github.com/raymoo/magical_realm ... t.lua#L272
Here is the minetest.after call: http://repo.or.cz/minetest_playereffect ... t.lua#l199
Here is the globalstep callback: repo.or.cz/minetest_playereffects.git/blob/HEAD:/init.lua#l405
I tried adding a line to print the duration right before it is passed to minetest.after, and it appears to be correct.