days of inactivity Reevaluate an environment/record every month Prevent X from happening if Y happened > $threshold ago In general, process an environment / data at a future point
' Y - m - d ' ) ; t i m e ( ) ; n e w D a t e T i m e ( ) ; s t r t o t i m e ( " + $ r e l a t i v e _ m o d i f i e r " ) ; N O W ( ) ; / / M y S Q L ' s e n t o u r a g e In general, code which compares against "now" scuppers us
uses MySQL's NOW() Extend DateTime, or better yet use "Carbon" Introduce indirection to determine "now" Allow "now" to be offset by a new DateTime https://github.com/briannesbitt/Carbon/pull/17
disruptive changes The most surefire way of testing this is by changing our PC's clock A little clumsy This leads to nasty problems on reboot Enter: A third party tool, which intercepts calls to Linux's c l o c k _ g e t t i m e
h p e c h o d a t e ( ' r ' ) ; s l e e p ( 1 0 ) ; e c h o d a t e ( ' r ' ) ; . / f l u x - c a p a c i t o r t e s t . p h p The application doesn't pause, but the clock advances
But PHP 5.4's built in server does! . / f l u x - c a p a c i t o r - - i d l e n e s s = 1 1 0 0 0 0 0 0 0 - - p h p - S l o c a l h o s t : 8 0 8 0 We need to set the idleness to > 1 second to prevent flux capacitor truncating the one second socket timeout used by PHP's internal web server