[php-src] Issue #7758: Datetime created from negative float timestamp is not monotonic (fraction part is added instead of substracted)

From: Date: Mon, 13 Dec 2021 14:27:27 +0000
Subject: [php-src] Issue #7758: Datetime created from negative float timestamp is not monotonic (fraction part is added instead of substracted)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238371@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/7758
Comment Author: mvorisek

> For the explanation: [fractional timestamps are currently not
> supported](https://www.php.net/manual/en/datetime.formats.compound.php) when parsing, which means
> PHP handles inputs like @-1.4 as an absolute "@-1" (1970 minus 1s) followed
> by a relative ".4" (plus 0.4s).

this is how it is parsed currently probably, however if unix timestamp is negative, the fractional
part must be decremented as if the whole TS was a standard floating point number

https://3v4l.org/rKOAb shows the fractional part cannot be even
used alone (eg. parsed with @ts token and the parsing must be fixed)


Thread (1 message)

  • mvorisek
« previous php.bugs (#238371) next »