Multibot finished

This commit is contained in:
HugeFrog24
2024-10-13 16:41:03 +02:00
parent 9f2b3df4c8
commit 0ab56448c7
15 changed files with 429 additions and 824 deletions

32
clock.go Normal file
View File

@@ -0,0 +1,32 @@
// clock.go
package main
import "time"
// Clock is an interface to abstract time-related functions.
type Clock interface {
Now() time.Time
}
// RealClock implements Clock using the actual time.
type RealClock struct{}
// Now returns the current local time.
func (RealClock) Now() time.Time {
return time.Now()
}
// MockClock implements Clock for testing purposes.
type MockClock struct {
currentTime time.Time
}
// Now returns the mocked current time.
func (mc *MockClock) Now() time.Time {
return mc.currentTime
}
// Advance moves the current time forward by the specified duration.
func (mc *MockClock) Advance(d time.Duration) {
mc.currentTime = mc.currentTime.Add(d)
}