Bug #80998 [Opn]: Missing second with inverted interval

From: Date: Wed, 05 May 2021 15:27:46 +0000
Subject: Bug #80998 [Opn]: Missing second with inverted interval
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233697@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80998&edit=1 ID: 80998 Updated by: cmb@php.net Reported by: kylekatarnls at gmail dot com Summary: Missing second with inverted interval Status: Open Type: Bug Package: Date/time related Operating System: Ubuntu PHP Version: master-Git-2021-04-28 (Git) -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: Derick, there might be an issue with timelib 2021.3. Previous Comments: ------------------------------------------------------------------------ [2021-04-28 09:07:47] kylekatarnls at gmail dot com Description: ------------ When adding an inverted interval containing microseconds, 1 second miss in the final result (with PHP >= 8.1 but not < 8.1) See https://github.com/kylekatarnls/datetime-bug/runs/2456014545 Test script: --------------- $date = new DateTime('2021-04-05 14:00:00'); $interval = new DateInterval('P0DT10799S'); $interval->f = 0.999999; $interval->invert = 1; $date->add($interval); $string = $date->format('Y-m-d H:i:s.u'); echo $string; Expected result: ---------------- 2021-04-05 11:00:00.000001 Actual result: -------------- 2021-04-05 11:00:01.000001 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80998&edit=1

« previous php.bugs (#233697) next »