Andrew Nicols 298c13ac3b
MDL-80838 core: Add PSR-20/Clock support
This commit adds the PSR-20 ClockInterface to core, with a
moodle-specific extension to the Interface at `\core\clock`, and a
standard clock at `\core\system_clock`.

Further clocks are provided as `\incrementing_clock` and `\frozen_clock`
which are available to unit tests using:

- `$this->mock_clock_with_incrementing(?int $starttime = null);`
- `$this->mock_clock_with_frozen(?int $time = null);`

For the incrementing clock, every call to fetch the time will bump the
current time by one second.

For the frozen clock the time will not change, but can be modified with:
- `$clock->set_to(int $time);`; and
- `$clock->bump(int $seconds = 1);`
2024-04-02 10:24:54 +08:00
..