Bug #75642 [Opn->Ver]: Wrap around behaviour for microseconds is not working
| From: | cmb@php.net | Date: | Fri, 09 Mar 2018 12:06:13 +0000 |
| Subject: | Bug #75642 [Opn->Ver]: Wrap around behaviour for microseconds is not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214248@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
Updated by: cmb@php.net
Reported by: marcospassos dot com at gmail dot com
Summary: Wrap around behaviour for microseconds is not
working
-Status: Open
+Status: Verified
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
Apparently[1]. However,
2017-12-31 23:59:59.1000000 is wrong
nonetheless.
[1] <https://3v4l.org/e3utY>
Previous Comments:
------------------------------------------------------------------------
[2018-01-21 19:12:30] marcospassos dot com at gmail dot com
Any update about this issue?
------------------------------------------------------------------------
[2017-12-06 22:26:26] spam2 at rhsoft dot net
pretty sure the sad float precision problem which makes me wonder why it's called computer and
not guesser
------------------------------------------------------------------------
[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