Re: [RFC] Duration class

From: Date: Thu, 18 Jun 2026 15:20:57 +0000
Subject: Re: [RFC] Duration class
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-131380@lists.php.net to get a copy of this message
On Thu, Jun 18, 2026, 4:02 PM Tim Düsterhus <tim@bastelstu.be> wrote: > Derick and I haven't discussed this, but the “minimal API” applies here > as well. Floating point versions we specifically left out (for now), > because we didn't want to go into the precision / rounding question. As > an example how many nanoseconds should 1.4 be? The internal > representation of that float is 1.3999999999999999. > I think precision doesn't matter here. The primary reason we added float total methods in Psl was to be able to bridge a Duration object to other APIs that accepted float $seconds ( mainly Revolt ), Rust and Java also both offer the floating point methods, and i think they make sense. Could be added in the future though. Another nitpick: I think the namespace should be DateTime if this is supposed to be start of a new API that covers both date and time, so we don't end up with two namespace later (which will share alot of things back and forth). Cheers, Seifeddine. >

« previous php.internals (#131380) next »