Get support for vdelau/clock
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
vdelau/clock
Psr\Clock implementations
This repository provides a couple of Psr\Clock
implementations, based on the draft PSR. This currently is not a package, it might become a package when the PSR is accepted.
System time
SystemClock
is the most simple Psr\Clock
implementation that always will return the current systemtime. It essential replaces new \DateTimeImmuitable()
.
Changing timezones
TimeZonedClock
and its descendants UTCClock
and LocalClock
are facades for other clock that will convert any clocks output to the desired timezone.
// $utc_clock->now() will always return a DateTimeImmutable in the UTC timezone
$utc_clock = new UTCClock(new SystemClock());
// $my_clock->now() will always return a DateTimeImmutable in the Europe/Amsterdam timezone
$my_clock = new TimeZonedClock(new SystemClock(), new DateTimeZone('Europe/Amsterdam'));
Stuck in time
FixedClock
will always return a DateTimeImmutable for the same date and time provided in the constructor.
RepeatableClock
will always return a DateTimeImmutable for the same date and time, obtained on the first call to now()
UnixEpochClock
will always return a DateTimeImmutable for the UNIX epoch 1970-01-01 00:00:00 UTC.
Controlled clocks
ManualClock
allows manual control over the DateTimeImmutable that is returned. It has convenience functions to add or subtract time intervals.
Sequenced clock allow the user to provide a list of DateTimeInterface object that will be returned in sequence. ManuallySequencedClock
progresses to the next provided DateTimeImmutable when calling tick. AutomaticallyProgressingClock
will progress to the next entry when calling now()
.
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2