Added early return option to next function that allows returning timestamp of next occurence instead of delay.
diff --git a/crontab/_crontab.py b/crontab/_crontab.py index fd7f0ca..4d227bb 100644 --- a/crontab/_crontab.py +++ b/crontab/_crontab.py
@@ -422,7 +422,7 @@ attr = attr() % 7 return self.matchers[index](attr, dt) - def next(self, now=None, increments=_increments, delta=True, default_utc=WARN_CHANGE): + def next(self, now=None, increments=_increments, delta=True, default_utc=WARN_CHANGE, return_datetime=False): ''' How long to wait in seconds before this crontab entry can next be executed. @@ -479,6 +479,9 @@ "crontab: %r\n" \ "now: %r", ' '.join(m.input for m in self.matchers), now) + if return_datetime: + return future + if not delta: onow = now = datetime(1970, 1, 1)