Documentation
¶
Overview ¶
Package awakeclock measures time the system was awake. Watchdogs use it so a laptop asleep past a deadline isn't treated as a hung process.
Index ¶
Constants ¶
const SleptThreshold = 5 * time.Minute
SleptThreshold is how far wall time may run ahead of awake time before a wait counts as having spanned a sleep.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
Clock reads awake time (excluding system sleep) and wall time.
var System Clock = systemClock{}
System is the real clock.
type Deadline ¶
type Deadline struct {
// contains filtered or unexported fields
}
Deadline is a start point on a Clock.
func (Deadline) Wait ¶
func (d Deadline) Wait(limit time.Duration, done <-chan struct{}, step time.Duration) (fired, slept bool)
Wait blocks until limit of awake time has passed since Begin (fired) or done is closed, polling every step. slept reports that wall time ran ahead of awake time by more than SleptThreshold meanwhile.