Re: [Discussion] Add date_test_set_now() function
| From: | Derick Rethans | Date: | Wed, 10 Jul 2024 15:48:43 +0000 |
| Subject: | Re: [Discussion] Add date_test_set_now() function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124354@lists.php.net to get a copy of this message | ||
On Mon, 1 Jul 2024, Go Kudo wrote:
> So, how about adding a `date_set_test_now(\DateInterval
> $shiftInterval)` function to ext-date?
>
> This function would treat the current time as shifted by the passed
> DateInterval. Since it's implemented on the ext-date side, there's no
> need for dirty hacks using usleep.
It's not that easy, as maney calculations are done in "timelib".
Especially for shifting times with relative times, the parser will need
to understand that too I suppose.
I am not keen on adding this global override to this library.
cheers,
Derick