PHP internals mailing list discussion of a proposed RFC to add a `Time\Duration` class to PHP 8.6. The class would represent stopwatch/egg-timer style durations (not calendar periods) using a seconds+nanoseconds internal representation, targeting timeout APIs and the new Polling API. The RFC is intentionally minimal to meet the PHP 8.6 feature freeze deadline and serve as the foundation for a broader modernized date/time API. Discussion covers design decisions including: why the highest constructor unit is hours while internal storage uses seconds, omission of ISO 8601 serialization and floating-point total methods for now, namespace choice (`Time` vs `DateTime`), whether to use `add`/`sub` vs a variadic `sum` method, and why the JavaScript Temporal/temporal_rs library was not adopted as-is due to PHP's different type system and Zend Engine integration concerns.

35m read timeFrom externals.io
Post cover image
1.7K Impressions