Skip to content

Commit

Permalink
comment: goroutine safe
Browse files Browse the repository at this point in the history
  • Loading branch information
name5566 committed Feb 25, 2015
1 parent f6d06ba commit a42a259
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions timer/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type CronExpr struct {
dow uint64
}

// goroutine safe
func NewCronExpr(expr string) (cronExpr *CronExpr, err error) {
fields := strings.Fields(expr)
if len(fields) != 5 && len(fields) != 6 {
Expand Down Expand Up @@ -185,6 +186,7 @@ func (e *CronExpr) matchDay(t time.Time) bool {
1<<uint(t.Day())&e.dom != 0
}

// goroutine safe
func (e *CronExpr) Next(t time.Time) time.Time {
// the upcoming second
t = t.Truncate(time.Second).Add(time.Second)
Expand Down

0 comments on commit a42a259

Please sign in to comment.