Watch the clock
summary
Proposal narrows to one method now() returning DateTimeImmutable so code stops calling time(), uses injected factory or clock object for predictability and testability. A small package implements the clock interface today with at least four interchangeable implementations (including a system clock and a frozen clock), letting tests inject deterministic times; PSR-20 aims to standardize this but the FIG vote is pending, so the package fills the gap and works as described.
AI-written summary · about
chapters (19)
- 0:00Introduction and motivation
- 1:51What is a clock interface
- 3:15Problem with impure time functions
- 7:36Injecting time to make it pure
- 10:49Using factories for predictable time
- 13:17Creating a clock interface
- 16:27Renaming to clock interface
- 17:11Why PSR-20 clock interface matters
- 18:34Short history of PHP-FIG
- 20:00How I got involved in PSR-20
- 21:47Simplifying the interface design
- 23:10Time zones and now as slice of time
- 27:06Interface vs implementation time zones
- 28:11PSR-20 next steps and timeline
- 29:12PSR-20 package implementation
- 31:18Q&A session begins
- 32:22Benefits of using DateTimeImmutable
- 34:09Understanding slice of now
- 36:39Law of Demeter and clock interface
related talks
29mTrusted Browsers for Uncertain Times
43mTic-Tac... Bomb! Master time and NTP before it's too late
11mWhat the heck time is it?!?
22mEffective Timekeeping in RISC-V Processors: Overview of mtime Design Approaches
43mMr Sandman: Time Lock Puzzles for Good and Evil
25mBeware the Bot Armies! Protecting RTC User Experience Using Simulations
24m🛠 using drand and timelock encryption
24m🛠 using drand and timelock encryption
