Source File
system.go
Belonging Package
github.com/gotd/td/clock
package clock
import
type systemTimer struct {
timer *time.Timer
}
func ( systemTimer) () <-chan time.Time {
return .timer.C
}
func ( systemTimer) ( time.Duration) {
.timer.Reset()
}
func ( systemTimer) () bool {
return .timer.Stop()
}
type systemTicker struct {
ticker *time.Ticker
}
func ( systemTicker) () <-chan time.Time {
return .ticker.C
}
func ( systemTicker) () {
.ticker.Stop()
}
func ( systemTicker) ( time.Duration) {
.ticker.Reset()
}
type systemClock struct{}
func ( systemClock) ( time.Duration) Ticker {
return systemTicker{ticker: time.NewTicker()}
}
func (systemClock) ( time.Duration) Timer {
return systemTimer{timer: time.NewTimer()}
}
func (systemClock) () time.Time { return time.Now() }
// System Clock.
var System Clock = systemClock{}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |