Replace timer-based SMA with a timer-less implementation

This commit is contained in:
Ingo Oppermann
2024-10-23 11:08:13 +02:00
parent 2dda47b81f
commit df30a6b8e3
17 changed files with 543 additions and 371 deletions

25
time/source.go Normal file
View File

@@ -0,0 +1,25 @@
package time
import "time"
type Source interface {
Now() time.Time
}
type StdSource struct{}
func (s *StdSource) Now() time.Time {
return time.Now()
}
type TestSource struct {
N time.Time
}
func (t *TestSource) Now() time.Time {
return t.N
}
func (t *TestSource) Set(sec int64, nsec int64) {
t.N = time.Unix(sec, nsec)
}