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
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:
HRTimeextension (poorly documented, no git source code)hrtime()function