Bug discovered with Moodle 1.6.3 on Linux 2.6 and PHP 5.2 .
Gather of statistics always starts 24 hours after the precedent gather.
I debug and found that at line #280 of file admin/cron.php strtotime function always returns 00:00 (today morning):
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
Indeed "today" parameter is not recognized by PHP.
Therefore the comparison (time() > $timetocheck) is always true. However statistics are (generally) not processed but delayed (until precedent gathering time) because of time interval of 24 hours specified in stats_cron_daily function about line #70 of lib/statslib.php.
So I have deleted this parameter:
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute");
May be a link with this PHP warning:
<< In PHP 5 up to 5.0.2, "now" and other relative times are wrongly computed from today's midnight. It differs from other versions where it is correctly computed from current time. >>
And, now, it works fine: gather of statistics always starts at 22:00.