Skip to content

Switch to using high resolution timers #2

Description

@dktapps

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions