no need for NoMatch(), existing time.IsZero() does the job well

This commit is contained in:
gorhill
2013-08-30 15:10:15 -04:00
parent d3a85f92d8
commit ae9c090812
2 changed files with 7 additions and 28 deletions

View File

@@ -88,13 +88,13 @@ to create a `CronExpression` object once and keep a copy of it for reuse:
nextTime := cronexpr.NextTime(time.Now())
...
Use `cronexpression.NoMatch()` to find out whether a valid time was returned. For example,
Use `nextTime.IsZero()` to find out whether a valid time was returned. For example,
cronexpression.NoMatch(cronexpression.NextTime("* * * * * 1980", time.Now()))
cronexpression.NextTime("* * * * * 1980", time.Now()).IsZero()
will return `true`, whereas
cronexpression.NoMatch(cronexpression.NextTime("* * * * * 2050", time.Now()))
cronexpression.NextTime("* * * * * 2050", time.Now()).IsZero()
will return `false` (as of 2013-08-29...)
@@ -143,9 +143,3 @@ Given a time stamp `fromTime`, return the closest following time stamp which mat
Given a time stamp `fromTime`, return a slice of `n` closest following time stamps which match the cron expression `cronexpr`. The time stamps in the returned slice are in chronological ascending order. The `time.Location` of the returned time stamps is the same as `fromTime`.
#### func NoMatch
func NoMatch(t time.Time) bool
Returns `true` if time stamp `t` is not a valid time stamp from `CronExpression` point of view. An invalid time stamp is returned by this library whenever no matching time stamp is found given a specific cron expression.