A PHP internals mailing list thread discussing a proposed RFC to introduce a new `Time\Duration` class in PHP 8.6. The class is designed to represent stopwatch-style durations (not calendar periods) to improve developer experience for timeout APIs, particularly the new Polling API. The RFC proposes a minimal API with seconds+nanoseconds internal representation, constructors up to hours, and ISO-8601 period string parsing. Discussion covers design decisions including omitting floating-point methods to avoid precision issues, choosing the `Time` namespace over `DateTime`, limiting ISO-8601 serialization to a future release, and API method naming (add/sub vs. sum). The RFC is positioned as the first step toward a modernized PHP date/time API, following the pattern of new namespaced APIs introduced in PHP 8.2–8.5.

1h 7m read timeFrom externals.io
Post cover image
365 Impressions