-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isDue() not working properly #161
Comments
Can you elaborate any further? At the end of the day all the library does is compare an expression against a timestamp (either the passed time, or the current system time) and tell you if that time is in the expression's limit. When it fails, is Can you also let me know what expression you are using, a sample time you are using that fails, what OS is failing, and which version of the library you are using? |
May be a separate issue than OP, but I'm seemingly having issues w/ Here's are logs of mine that illustrate the problem: Logs
Here's the code that generates that log: Codeprivate const CRON_SCHEDULE = '* 15 * * *';
private const TIME_ZONE = 'America/New_York';
$cron = new CronExpression(self::CRON_SCHEDULE);
$this->logger->debug(
sprintf(
'Current time %s',
(new DateTime('now'))->setTimezone(new DateTimeZone(self::TIME_ZONE))->format('Y-m-d H:i:s')
)
);
if (!$cron->isDue('now', self::TIME_ZONE)) {
$this->logger->debug('Cron is not due.');
$this->logger->debug(
sprintf(
'Cron should have last run at %s',
$cron->getPreviousRunDate()->format('Y-m-d H:i:s')
)
);
$this->logger->debug(
sprintf(
'Cron will next run at %s',
$cron->getNextRunDate()->format('Y-m-d H:i:s')
)
);
return;
} Since the current time is I've been poking around for some time now but haven't been to determine why this is behaving the way it is. Will update this post if I make any headway, but would appreciate any ideas in the meantime. I'm running Update: Just determined that the |
$cron = new CronExpression($cronExpression); $cron->isDue($currentTime)
isDue() is not working as expected - on one of the servers it returns false. But when I'm testing it in a local environment returns true. $currentTime is the same as system datatime. It seems that it may be related with NTP server configuration issues.
The text was updated successfully, but these errors were encountered: