Files
sing-box-extended-mirror/common/tls/time_wrapper.go
T

26 lines
389 B
Go
Raw Normal View History

2024-12-14 22:41:58 +08:00
package tls
import (
"time"
"github.com/sagernet/sing/common/ntp"
)
type TimeServiceWrapper struct {
ntp.TimeService
}
func (w *TimeServiceWrapper) TimeFunc() func() time.Time {
2025-07-23 18:22:52 +08:00
return func() time.Time {
if w.TimeService != nil {
return w.TimeService.TimeFunc()()
} else {
return time.Now()
}
2024-12-14 22:41:58 +08:00
}
}
func (w *TimeServiceWrapper) Upstream() any {
return w.TimeService
}