You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently it was discovered that system time changes during SleeperHandler->sleepUntil() will cause the sleeper to break. Changing the time forward causes the sleeper not to sleep at all for that call (which is OK), but changing the time backwards causes an extended sleep until the originally specified time, which has now moved into the future.
Example:
caller sleeps for now + 50,000 microseconds
system time changes back by 3 hours
sleeper handler now sleeps for 3 hours + 50,000 microseconds
This is undesirable for PocketMine-MP for obvious reasons.
Solutions:
use the HRTime extension (poorly documented, no git source code)
force an upgrade to PHP 7.3 to get access to the new hrtime() function
The text was updated successfully, but these errors were encountered:
I've attempted to implement this and arrived at the conclusion that providing an API like Threaded->wait(timeout) on SleeperHandler would be better for this purpose. This would shift the responsibility of deciding what kind of time measurement to use to the implementation, and Snooze would then not need to mess around calculating remaining sleep times.
This would make the API slightly more difficult to use, but since only PM uses this library anyway, I don't think that's a particularly big problem.
Recently it was discovered that system time changes during
SleeperHandler->sleepUntil()
will cause the sleeper to break. Changing the time forward causes the sleeper not to sleep at all for that call (which is OK), but changing the time backwards causes an extended sleep until the originally specified time, which has now moved into the future.Example:
This is undesirable for PocketMine-MP for obvious reasons.
Solutions:
HRTime
extension (poorly documented, no git source code)hrtime()
functionThe text was updated successfully, but these errors were encountered: