@@ -219,19 +219,19 @@ func TestRunningMultipleSchedules(t *testing.T) {
219219// Test that the cron is run in the local time zone (as opposed to UTC).
220220func TestLocalTimezone (t * testing.T ) {
221221 wg := & sync.WaitGroup {}
222- wg .Add (1 )
222+ wg .Add (2 )
223223
224224 now := time .Now ().Local ()
225- spec := fmt .Sprintf ("%d %d %d %d %d ?" ,
226- now .Second ()+ 1 , now .Minute (), now .Hour (), now .Day (), now .Month ())
225+ spec := fmt .Sprintf ("%d,%d %d %d %d %d ?" ,
226+ now .Second ()+ 1 , now .Second () + 2 , now . Minute (), now .Hour (), now .Day (), now .Month ())
227227
228228 cron := New ()
229229 cron .AddFunc (spec , func () { wg .Done () })
230230 cron .Start ()
231231 defer cron .Stop ()
232232
233233 select {
234- case <- time .After (ONE_SECOND ):
234+ case <- time .After (ONE_SECOND * 2 ):
235235 t .FailNow ()
236236 case <- wait (wg ):
237237 }
@@ -240,7 +240,7 @@ func TestLocalTimezone(t *testing.T) {
240240// Test that the cron is run in the given time zone (as opposed to local).
241241func TestNonLocalTimezone (t * testing.T ) {
242242 wg := & sync.WaitGroup {}
243- wg .Add (1 )
243+ wg .Add (2 )
244244
245245 loc , err := time .LoadLocation ("Atlantic/Cape_Verde" )
246246 if err != nil {
@@ -249,16 +249,16 @@ func TestNonLocalTimezone(t *testing.T) {
249249 }
250250
251251 now := time .Now ().In (loc )
252- spec := fmt .Sprintf ("%d %d %d %d %d ?" ,
253- now .Second ()+ 1 , now .Minute (), now .Hour (), now .Day (), now .Month ())
252+ spec := fmt .Sprintf ("%d,%d %d %d %d %d ?" ,
253+ now .Second ()+ 1 , now .Second () + 2 , now . Minute (), now .Hour (), now .Day (), now .Month ())
254254
255255 cron := NewWithLocation (loc )
256256 cron .AddFunc (spec , func () { wg .Done () })
257257 cron .Start ()
258258 defer cron .Stop ()
259259
260260 select {
261- case <- time .After (ONE_SECOND ):
261+ case <- time .After (ONE_SECOND * 2 ):
262262 t .FailNow ()
263263 case <- wait (wg ):
264264 }
0 commit comments