Hi Tim
On 6/18/26 15:47, Tim Düsterhus wrote:
Hi
Derick and I are proposing the introduction of a new `Time\Duration`
class to represent “stop-watch” or “egg-timer” durations to improve
the developer experience for APIs taking a timeout. We are
specifically targeting PHP 8.6 for this RFC, since part of the
motivation is improving the API of the new “Polling API” that already
landed in PHP 8.6 (https://wiki.php.net/rfc/poll_api) before the
“backwards compatibility” door closes with the feature freeze in two
months.
This RFC is also intended to be a first part of a modernized date and
time API in PHP, while being useful on its own. To that extent and
given the deadline we hope to make, the proposed API is intentionally
minimal and focused on functionality that we are relatively certain to:
1. Be correct, or
2. be requirement for future additions that cannot later be added
without breaking compatibility.
We would therefore ask to keep the discussion focused on actual issues
rather than additional “convenience functionality” that might require
extensive discussion or thought.
All that said, you can find the RFC at:
https://wiki.php.net/rfc/duration_class. It hopefully includes all the
important explanation and also provides a rationale as to why we made
the design decisions we made.
Best regards
Tim Düsterhus
Hi Tim,
Rather than building a whole new date/time library, did you consider
using the temporal_rs library instead? This library is used for the new
Temporal API that is now available in Firefox and Chrome and is
a browser standard.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal
The temporal_rs library is already used in V8, Boa and Kiesel. This
means the library has a large user-base, that is actively developed, but
also stable because it needs to adhere to the standards.
Regards,
Frederik