Tim Düsterhus and Derick Rethans have proposed a new `Time\Duration` class for PHP 8.6, targeting 'stopwatch' or 'egg-timer' style durations to improve developer experience 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 highest constructor unit being hours, omitting ISO 8601 serialization for now due to ambiguity, excluding floating-point methods to avoid precision/rounding issues, using the `Time` namespace (aligned with Rust, Java, Go conventions), and rejecting the temporal_rs Rust library as a backend due to integration complexity. Community feedback covers suggestions like a variadic `sum()` method instead of separate `add`/`sub`, namespace naming, and ISO 8601 format concerns.

52m read timeFrom externals.io
Post cover image
362 Impressions