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 using seconds+nanoseconds internal representation, similar to Rust's and Java's Duration types. Discussion covers design decisions including: why the highest constructor unit is hours, omission of ISO 8601 serialization (deferred to PHP 8.7), exclusion of floating-point methods due to precision concerns, namespace choice (`Time` vs `DateTime`), and whether to use `add`/`sub` methods or a single variadic `sum` method. The RFC is explicitly positioned as the first step toward a modernized PHP date/time API.

1h 18m read timeFrom externals.io
Post cover image
351 Impressions