Tim Düsterhus and Derick Rethans have proposed a new `Time\Duration` class for PHP 8.6, designed to represent stopwatch-style durations for timeout APIs. The RFC is intentionally minimal, using a seconds+nanoseconds internal representation (similar to Rust's and Java's Duration). Key design decisions discussed include: the `Time` namespace choice over `DateTime`, omitting floating-point conversion methods to avoid precision/rounding issues, limiting ISO 8601 parsing to period strings starting with `PT`, and deferring ISO 8601 serialization to a future release. Community feedback raised questions about the `fromIso8601String` naming ambiguity, whether to use `add`/`sub` vs. a variadic `sum` method, and whether to adopt the `temporal_rs` Rust library (rejected due to API mismatch and Zend Engine integration complexity). The RFC is positioned as the first step in a modernized PHP date/time API.

24m read timeFrom externals.io
Post cover image
291 Impressions