File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ func (c *Cron) run() {
196
196
197
197
case newEntry := <- c .add :
198
198
c .entries = append (c .entries , newEntry )
199
- newEntry .Next = newEntry .Schedule .Next (time .Now ().Local ( ))
199
+ newEntry .Next = newEntry .Schedule .Next (time .Now ().In ( c . location ))
200
200
201
201
case <- c .snapshot :
202
202
c .snapshot <- c .entrySnapshot ()
Original file line number Diff line number Diff line change @@ -116,9 +116,9 @@ func TestAddWhileRunningWithDelay(t *testing.T) {
116
116
defer cron .Stop ()
117
117
time .Sleep (5 * time .Second )
118
118
var calls = 0
119
- cron .AddFunc ("* * * * * *" , func () { calls += 1 });
119
+ cron .AddFunc ("* * * * * *" , func () { calls += 1 })
120
120
121
- <- time .After (ONE_SECOND )
121
+ <- time .After (ONE_SECOND )
122
122
if calls != 1 {
123
123
fmt .Printf ("called %d times, expected 1\n " , calls )
124
124
t .Fail ()
@@ -237,7 +237,6 @@ func TestLocalTimezone(t *testing.T) {
237
237
}
238
238
}
239
239
240
-
241
240
// Test that the cron is run in the given time zone (as opposed to local).
242
241
func TestNonLocalTimezone (t * testing.T ) {
243
242
wg := & sync.WaitGroup {}
You can’t perform that action at this time.
0 commit comments