mirror of
https://github.com/beste/clock.git
synced 2026-08-17 17:47:13 +00:00
Initial Release
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
use Beste\Clock\FrozenClock;
|
||||
use Beste\Clock\MinuteClock;
|
||||
|
||||
$frozenClock = FrozenClock::at(new DateTimeImmutable('01:23:45'));
|
||||
$clock = MinuteClock::wrapping($frozenClock);
|
||||
|
||||
printf("For %s, the minute clock returns %s\n",
|
||||
$frozenClock->now()->format('H:i:s'),
|
||||
$clock->now()->format('H:i:s')
|
||||
);
|
||||
|
||||
$frozenClock->setTo($frozenClock->now()->modify('+10 seconds')); // 01:23:55
|
||||
|
||||
printf("For %s, the minute clock still returns %s\n",
|
||||
$frozenClock->now()->format('H:i:s'),
|
||||
$clock->now()->format('H:i:s')
|
||||
);
|
||||
Reference in New Issue
Block a user