Bug #75642 [Com]: Wrap around behaviour for microseconds is not working
| From: | spam2 at rhsoft dot net | Date: | Wed, 06 Dec 2017 22:26:26 +0000 |
| Subject: | Bug #75642 [Com]: Wrap around behaviour for microseconds is not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212981@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75642&edit=1
ID: 75642
Comment by: spam2 at rhsoft dot net
Reported by: marcospassos dot com at gmail dot com
Summary: Wrap around behaviour for microseconds is not
working
Status: Open
Type: Bug
Package: Date/time related
Operating System: OSX
PHP Version: 7.2.0
Block user comment: N
Private report: N
New Comment:
pretty sure the sad float precision problem which makes me wonder why it's called computer and
not guesser
Previous Comments:
------------------------------------------------------------------------
[2017-12-06 22:12:12] marcospassos dot com at gmail dot com
Expected result:
----------------
2017-12-31 23:59:59.999999
2018-01-01 00:00:00.000000
------------------------------------------------------------------------
[2017-12-06 22:11:26] marcospassos dot com at gmail dot com
Description:
------------
When adding 1 microsecond to 999999 does not increment the seconds part.
Test script:
---------------
// https://3v4l.org/Wl6if
$date = new \DateTime('2017-12-31 23:59:59.999999');
echo $date->format('Y-m-d H:i:s.u');
echo "\n";
echo $date->modify('+1 microsecond')->format('Y-m-d H:i:s.u');
Expected result:
----------------
2017-12-31 23:59:59.999999
2016-01-01 00:00:00.000000
Actual result:
--------------
2017-12-31 23:59:59.999999
2017-12-31 23:59:59.1000000
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75642&edit=1