Hey all

Am 04.03.21 um 13:34 schrieb Chris Seufert:
> Hello,
> 
> I would like to propose standardizing a clock interface for reading the 
> current time, date, timestamp, and timezone.
> 
> The problems I hope to solve is when testing time sensitive code, there is 
> a unified way to represend the current time. I have run into several issues 
> doing this some of which are:
> - Some library use different Clock interfaces / implementations.
> - Its impossible to mock some calls to date and time without using a PHP 
> extension to override the current time & date.
> - There are about 10 competing library implentations to this problem just 
> from a quck search on packagist
> 
> The proposed interface would look like this:
> 
> interface ClockInterface
> {
>     public function timestamp():int;
>     
>     public function immutable():\DateTimeImmutable;
>     
>     public function datetime():\DateTime
> 
>      public function microtime():float
>      
>      public function timezone():\DateTimeZone
> }
> 
> I have created a pull request for this here:
> https://github.com/php-fig/fig-standards/pull/1224
> 
> I am looking to find out if anyone is interesting in sponsoring this 
> Standard.
> 
> I have enjoyed using the PSR-16 interopable caches, and also migrated a 
> large legacy application to use PSR-7/PSR-15 and also benefits from using 
> standard middlewares and request extensions, and hope this could provide a 
> similar experience in the future.

I won't be able to act as sponsor but would be available for a working
group if that is helpful.

Cheers

Andreas
-- 
                                                              ,,,
                                                             (o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl                                                       |
| mailto:[email protected]                  N 50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org                                           |
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas                               |
+---------------------------------------------------------------------+

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/67a54cec-28bc-e547-6e7f-d6d1c77aa44a%40heigl.org.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to