Login   Register  
PHP Classes
elePHPant
Icontem

Bug at midnight

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      tdCron  >  All threads  >  Bug at midnight  >  (Un) Subscribe thread alerts  
Subject:Bug at midnight
Summary:Wrong nextrun() when current time is midnight
Messages:1
Author:Eric
Date:2013-02-13 17:33:36
 

  1. Bug at midnight   Reply  
Picture of Eric
Eric
2013-02-13 17:33:36
The getNextOccurrence() method returns the wrong value when the timestamp is midnight and the crontab expression is "* * * * *".

For example, if the current timestamp is '2013-02-13 00:00:00', getNextOccurrence() will return '2013-02-14 00:00:00' (midnight the *next* day). It should return '2013-02-13 00:01:00' (one minute past midnight on the current day).


Add this entry to the test.data.php file to show the problem:

$tests[] = array(
'desc' => 'Just a simple at midnight -> * * * * *',
'expression' => '* * * * *',
'reftime' => mktime(0,0,0,2,1,2010),
'expected_l' => '01.02.2010, 00:00:00',
'expected_n' => '01.02.2010, 00:01:00'
);