mirror of
https://github.com/HugeFrog24/go-telegram-bot.git
synced 2026-08-28 22:11:38 +00:00
Adaptive thinking
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import "time"
|
||||
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
}
|
||||
|
||||
type RealClock struct{}
|
||||
|
||||
func (RealClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
type MockClock struct {
|
||||
currentTime time.Time
|
||||
}
|
||||
|
||||
func (mc *MockClock) Now() time.Time {
|
||||
return mc.currentTime
|
||||
}
|
||||
|
||||
func (mc *MockClock) Advance(d time.Duration) {
|
||||
mc.currentTime = mc.currentTime.Add(d)
|
||||
}
|
||||
Reference in New Issue
Block a user