github.com/sandwich-go/boost@v1.3.29/xtime/README.md (about) 1 # xtime 2 3 `time` 辅助函数 4 5 - 时间函数 6 - 时间模拟 7 - `timewheel` 8 9 # 例子 10 ```go 11 w := NewWheel(time.Second, 3) 12 defer w.Stop() 13 14 time.Sleep(500 * time.Millisecond) 15 t1 := time.Now() 16 17 go func() { 18 select { 19 case <-w.After(1 * time.Second): 20 fmt.Printf("expected 1s, got %s\n", time.Since(t1)) 21 } 22 }() 23 ``` 24 Output: 25 ```text 26 expected 1s, got 1.498680893s 27 ```