timer.go 351 B

12345678910111213141516171819202122232425
  1. package clock
  2. import "time"
  3. type Timer interface {
  4. C() <-chan time.Time
  5. Reset(d time.Duration) bool
  6. Stop() bool
  7. }
  8. type realTimer struct {
  9. t *time.Timer
  10. }
  11. func (t *realTimer) C() <-chan time.Time {
  12. return t.t.C
  13. }
  14. func (t *realTimer) Reset(d time.Duration) bool {
  15. return t.t.Reset(d)
  16. }
  17. func (t *realTimer) Stop() bool {
  18. return t.t.Stop()
  19. }