Skip to content

Commit

Permalink
remove unnecessary prev field (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongkuancn authored Nov 5, 2024
1 parent 81b84fc commit 0dc39eb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions clockwerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ type Job interface {
type Entry struct {
Period time.Duration
Next time.Time
Prev time.Time
Job Job
}

func newEntry(period time.Duration) *Entry {
return &Entry{
Period: period,
Prev: time.Unix(0, 0),
}
}

Expand Down Expand Up @@ -78,9 +76,7 @@ func (c *Clockwerk) Stop() {
}

func (c *Clockwerk) schedule(e *Entry) {
e.Prev = time.Now()

e.Next = e.Prev.Add(e.Period)
e.Next = time.Now().Add(e.Period)
}

func (c *Clockwerk) run() {
Expand Down

0 comments on commit 0dc39eb

Please sign in to comment.