Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalTimeService = NewMockTimeService(1800)
Functions ¶
This section is empty.
Types ¶
type AlarmClock ¶
type AlarmClock struct {
// contains filtered or unexported fields
}
func NewAlarmClock ¶
func NewAlarmClock(name string, hour int, minute int, repeatable bool) *AlarmClock
func (*AlarmClock) ID ¶
func (ac *AlarmClock) ID() string
func (*AlarmClock) NextAlarmTime ¶
func (ac *AlarmClock) NextAlarmTime() *time.Time
func (*AlarmClock) Occurs ¶
func (ac *AlarmClock) Occurs() int
func (*AlarmClock) TimeElapsed ¶
func (ac *AlarmClock) TimeElapsed(now *time.Time)
type ITimeObserver ¶
定义时间观察者接口, 接收时间变化事件的通知
type ITimeService ¶
type ITimeService interface { Attach(observer ITimeObserver) //注册 Detach(id string) // 注销 }
定义时间服务的接口, 接受观察者的注册和注销
func NewMockTimeService ¶
func NewMockTimeService(speed int64) ITimeService
Click to show internal directories.
Click to hide internal directories.