PHP is getting a real type for elapsed time. The Time\Duration RFC from Tim Düsterhus and Derick Rethans passed 35 to 1, and the implementation was merged into php-src on August 7, 2026, so it lands in PHP 8.6.
Right now, if a function needs a duration, it takes an int and you have to know which unit it wants. Sometimes it's seconds, sometimes milliseconds, sometimes a pair of $seconds and $microseconds parameters, and sometimes a float that loses precision.
DateInterval doesn't fill the gap either. It carries calendar units, and those don't map to a fixed number of seconds. A day is 23 or 25 hours across a daylight saving change, and a month runs anywhere from 28 to 31 days, so a P1D interval only means something once you hand it a date and a timezone. That's the right behavior for "this time next week", and the wrong tool for "give up after 30 seconds". Time\Duration covers the second case, what the RFC calls "stop-watch time", the kind you use for timeouts, backoff policies, and work on a fixed schedule.
What It Looks Like
The class is final readonly and has no public constructor. You build one through named constructors, picking whichever resolution fits:
use Time\Duration; $oneSecond = Duration::fromSeconds(1); $halfSecond = $oneSecond->divideBy(2); $onePointFive = $oneSecond->add($halfSecond); $baseDelay = Duration::fromMilliseconds(100); $delay = $baseDelay->multiplyBy(2 ** 5); // 3.2 seconds
There's fromSeconds(), fromNanoseconds(), fromMicroseconds(), fromMilliseconds(), fromMinutes(), fromHours(), and fromIso8601DurationString(). Each of the single-value constructors takes exactly one argument on purpose, so you can't write two different combinations that quietly produce the same duration through overflow.
For math you get add(), sub(), multiplyBy(), divideBy(), negate(), absolute(), and a static compare() that returns -1, 0, or 1. The class implements comparison handlers, so < and > work directly on two Duration objects, and compare() drops straight into a sort:
usort($durations, Duration::compare(...));
Arithmetic operators are not overloaded. If you want addition, you call ->add().
Seconds, Nanoseconds, and a Negative Flag
The state is three public readonly properties: $seconds, $nanoseconds, and $negative. Splitting seconds from nanoseconds keeps 32-bit PHP workable, since a signed 32-bit int holds a full second's worth of nanoseconds. $seconds is capped at 9,223,372,035 (roughly 292 years) even on 64-bit builds, leaving room for a future getTotalNanoseconds(). Anything that overflows throws the new Time\TimeException.
Negative durations get their own boolean rather than a sign on the numbers, which means you can take an absolute value by ignoring one property. A zero duration always normalizes $negative to false, and creating a negative duration takes an explicit ->negate() call.
The Vote
The primary vote closed at 35 yes, 1 no, and 2 abstain, well past the two-thirds majority. A secondary vote settled method naming: 30 votes went to the full names (multiplyBy, divideBy, negate, absolute) against 2 for the abbreviated versions (mul, divBy, neg, abs), with 3 abstaining.
What It Means for Your Code
Nothing breaks. The RFC adds new symbols in a new Time namespace, and a GitHub search turned up only 7 userland classes that would collide.
It also doesn't change existing functions. The sleep() examples in the RFC are hypothetical, and the one real integration is the new polling API, where Io\Poll\Context::wait() will take a ?Time\Duration $timeout instead of separate timeout and microsecond parameters. What you can do today is accept Time\Duration in your own APIs instead of an int and a unit you have to document.
This is also the first piece of a modernized date and time library for PHP. Future scope covers an "Instant" type whose differences return a Duration, plus a separate calendar-aware interval class for days, weeks, and months. DateInterval isn't going anywhere for the calendar work it already does.
Read the full Duration class RFC for the complete stub, the design rationale, and the userland proof of concept.