Skip to content

Commit

Permalink
Fixed remaining time.Now().Local()
Browse files Browse the repository at this point in the history
  • Loading branch information
daft-panda committed Aug 12, 2016
1 parent 5a4c557 commit 17583de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (c *Cron) run() {

case newEntry := <-c.add:
c.entries = append(c.entries, newEntry)
newEntry.Next = newEntry.Schedule.Next(time.Now().Local())
newEntry.Next = newEntry.Schedule.Next(time.Now().In(c.location))

case <-c.snapshot:
c.snapshot <- c.entrySnapshot()
Expand Down
5 changes: 2 additions & 3 deletions cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ func TestAddWhileRunningWithDelay(t *testing.T) {
defer cron.Stop()
time.Sleep(5 * time.Second)
var calls = 0
cron.AddFunc("* * * * * *", func() { calls += 1 });
cron.AddFunc("* * * * * *", func() { calls += 1 })

<- time.After(ONE_SECOND)
<-time.After(ONE_SECOND)
if calls != 1 {
fmt.Printf("called %d times, expected 1\n", calls)
t.Fail()
Expand Down Expand Up @@ -237,7 +237,6 @@ func TestLocalTimezone(t *testing.T) {
}
}


// Test that the cron is run in the given time zone (as opposed to local).
func TestNonLocalTimezone(t *testing.T) {
wg := &sync.WaitGroup{}
Expand Down

0 comments on commit 17583de

Please sign in to comment.