NewClock 添加一个新时钟
(db *sql.Sqlite)
| 38 | |
| 39 | // NewClock 添加一个新时钟 |
| 40 | func NewClock(db *sql.Sqlite) (c Clock) { |
| 41 | c.cron = cron.New() |
| 42 | c.entries = make(map[uint32]cron.EntryID) |
| 43 | c.timers = &map[uint32]*Timer{} |
| 44 | c.loadTimers(db) |
| 45 | c.cron.Start() |
| 46 | return |
| 47 | } |
| 48 | |
| 49 | // RegisterTimer 注册计时器 |
| 50 | func (c *Clock) RegisterTimer(ts *Timer, save, isinit bool) bool { |