Home > Code Snippets, PHP, Tips > Setting session timestamp limited to script scope in PHP

Setting session timestamp limited to script scope in PHP

September 24th, 2013 Leave a comment Go to comments

Lets start with analyzing a use case. Well at Saturn we required to run a cron
job which was written in php, with a lot of use for date functions, every day
starting Jan 1 2001 to Dec 31 2012. I did not dig much into override_function
to change the behavior of the date function, instead a small class was written
to handle the ticks, but the loop was run using a history table in mysql.

The class which keeps the ticks was called clock, and is attached here. Which
provided to be useful while the debug messages of the cron was being logged, with
each message showing the date time at the start.

Yes I had to copy the cron code, and globally modify the date function with a
custom wrapper, like theDate(), and then inside theDate() the conditions were
written as theDate takes two arguments with the second one optional.

Class Clock (533)

  1. No comments yet.
  1. No trackbacks yet.

one + = five