The Clock component handles time determination.

    string $datetime = "now",
    ?DateTimeZone $timezone = null
use Centum\Clock\Clock;

$clock = new Clock();

Centum\Clock\Clock implements Centum\Interfaces\Clock\ClockInterface.

The now() method returns a DateTimeImmutable instance that can be used for when your code needs to reference the current time.

$now = $clock->now();


This can be useful in testing that has timing-based side effects to ensure that tests are consistent and repeatable.

Table of contents