Re: [RFC] Time\Instant and Time\Clock
| From: | Andreas Heigl | Date: | Tue, 22 Sep 2026 14:54:23 +0000 |
| Subject: | Re: [RFC] Time\Instant and Time\Clock | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132590@lists.php.net to get a copy of this message | ||
Hey Tim, Hey Derick
On 22 Sep 2026, at 16:20, Tim Düsterhus wrote:
> Hi
>
> following Time\Duration in PHP 8.6, Derick and I created an RFC for Time\Instant and Time\Clock
> as the next part of the new date and time API:
>
> https://wiki.php.net/rfc/time_instant_class
>
> This time we have several months until the next feature freeze, so there’s place to discuss
> additional functionality that we missed. Nevertheless we would like to keep the RFC focused so that
> every decision gets the attention it deserves and some bits are already listed as “Future Scope”
> to that effect.
Thanks for the proposal.
I do see some clashes within the proposal though:
Right at the start you are mentioning that "An Time\Instant carries no timezone. It represents
a unique point on the timeline of the universe. This point is the same for everyone, no matter where
they are located on the Earth (or not on Earth at all), i.e. no matter their timezone."
I am totally in favour of that!
Later on though you are mentioning that "Following the lead of virtually all programming
languages and operating systems, leap seconds are ignored."
Is that only with relation to the Iso8601 strings? Or is that a general shortcoming?
The other point I find irritating is the naming of the
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Clock interface. While I can
understand the reasoning behind it I see irritation in the community upcoming as the
CLockInterface now suddenly returns 2 different things, depending on which
ClockInterface people are talking about.
Is there a way to Unify the ideas behind Time\Clock and Psr\Clock\CLockInterface?
As right now the Time\Clock is not a direct replacement of Psr\Clock\ClockInterface as - at the
current time - there is no way to generate a DateTimeImmutable directly from a Time\Instant.
Just my 0.02€
Cheers
Andreas
--
,,,
(o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl |
| mailto:andreas@heigl.org N
50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org
|
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas
|
+---------------------------------------------------------------------+
| GPG-Key: https://hei.gl/keyandreasheiglorg
|
+---------------------------------------------------------------------+
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc