Small Error Gap But Big
<p>My site requires users to complete a certain task on the site everyday before the end of the day 23:59:59 (don't worry about timezones or the task)</p>

<p>The task has a <code>$today_status</code> (<code>complete</code> or <code>incomplete</code>)</p>

<p>I have a cron that runs at the start of the day (00:00:01) to do 2 things:</p>

<ol>
<li>Check if all tasks were completed yesterday (check for all tasks that are still incomplete).</li>
<li>Reset all of yesterdays tasks back to incomplete so the user can start the task again today (for the new day).</li>
</ol>

<p>Each task has a count down timer displayed next to it so that the user can see one of the following two timers:</p>

<ol>
<li>(<code>IF $today_status = incomplete</code>) -  the time they have left to complete the task (counting down to the end of the day).</li>
<li>(<code>IF $today_status = complete</code>) - the time they have to wait before they can complete the second task (counting down to the end of the day).</li>
</ol>

<p>I have 2 small problems that are related:</p>

<p>The crons runs as soon as it turns into a new day at 00:00:01 however the cron not might finish processing all of the tasks until 00:07:19 so there is a 7 min error gap... this could increase as more users join.</p>

<p>So, if the user has completed the task for the previous day, and then views the task at 00:03:27 the next day... <code>$today_status</code> could still be <code>completed</code> as the cron might not have processed it for the previous day yet... and there for the timer will say</p>

<p>23:54:33 
(time left to wait before you can start the next task)</p>

<p>It will say the above because it is still in 'complete' status... however the user just logged in early so they could complete today's task early BUT the site is telling them otherwise... it is telling them they have to wait until tomorrow to complete the next task...</p>

<p>I hope i am explaining this correctly and thank you so much if you have bothered to read down this far... any help will be greatly appreciated... thanks in advance</p>
