Tim Düsterhus and Derick Rethans have proposed a new `Time\Duration` class for PHP 8.6 to represent stopwatch-style durations, primarily to improve the developer experience for timeout APIs including the new Polling API. The RFC is intentionally minimal, using a seconds+nanoseconds internal representation (similar to Rust's and Java's Duration). The mailing list discussion covers design decisions including: why the highest constructor unit is hours while internal storage uses seconds; the absence of ISO 8601 serialization (deferred to PHP 8.7); omission of floating-point total methods due to precision concerns; the choice of `Time` namespace over `DateTime`; rejection of using the temporal_rs Rust library as a backend; and debate over whether to use `add`/`sub` methods or a single variadic `sum` method.

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