incorrect time returned on Ticker channel
Closed this issue · 1 comments
vikstrous commented
test:
package main
import (
"fmt"
"time"
"github.com/WatchBeam/clock"
)
func main() {
date, _ := time.Parse(time.UnixDate, "0")
c := clock.NewMockClock(date)
ticker := c.NewTicker(time.Second)
ch := ticker.Chan()
done := make(chan struct{})
go func() {
chTime := <-ch
cTime := c.Now()
fmt.Println(chTime)
fmt.Println(cTime)
close(done)
}()
c.AddTime(time.Second)
<-done
}
expected:
0001-01-01 00:00:01 +0000 UTC
0001-01-01 00:00:01 +0000 UTC
actual:
2016-12-06 11:19:51.326261153 +0000 UTC
0001-01-01 00:00:01 +0000 UTC