Files
funknetz/station/clock.go
T
Konrad NeitzelandCursor 9c4f6621fc Join one FM-Funknetz talk group from a headset window.
The station reads ~/.funknetz.json, speaks protocol 2.0, and builds an unsigned funknetz.app.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-03 16:21:41 +02:00

33 lines
650 B
Go

package station
import "time"
// Clock is the time source for heartbeats and the retry wait.
type Clock interface {
Now() time.Time
NewTimer(d time.Duration) Timer
}
// Timer is a single deadline. Stop prevents the channel from firing.
type Timer interface {
C() <-chan time.Time
Stop() bool
}
type wallClock struct{}
func (wallClock) Now() time.Time { return time.Now() }
func (wallClock) NewTimer(d time.Duration) Timer {
if d < 0 {
d = 0
}
return wallTimer{t: time.NewTimer(d)}
}
type wallTimer struct{ t *time.Timer }
func (w wallTimer) C() <-chan time.Time { return w.t.C }
func (w wallTimer) Stop() bool { return w.t.Stop() }