Documentation
¶
Overview ¶
Package wallclock is the time a clock on screen shows, which unlike the timers of the runtime is what the user reads off their wall: it moves on through a suspend, and jumps when NTP or an administrator sets it or the time zone changes.
Index ¶
Constants ¶
const LocaltimePath = "/etc/localtime"
LocaltimePath is the file the machine's time zone is set in.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SystemClock ¶
type SystemClock struct {
// contains filtered or unexported fields
}
SystemClock is the wall clock of this machine. An absolute timer on CLOCK_REALTIME fires on the wall clock's time however long the machine slept, and TFD_TIMER_CANCEL_ON_SET fails its read the moment the clock is set; a watch on the zone file reloads the zone, which the runtime only reads once. With TZ set the zone is the one TZ names, and the file is not watched.
func NewSystemClock ¶
func NewSystemClock(invoke func(func()), zonePath string) (*SystemClock, error)
NewSystemClock starts a clock that follows the zone set in zonePath and runs what is armed through invoke, on the loop.
func (*SystemClock) Arm ¶
func (c *SystemClock) Arm(at time.Time, fn func())
Arm runs fn on the loop when the wall clock reaches at, or at once when it or the zone jumps, replacing what was armed.
func (*SystemClock) Close ¶
func (c *SystemClock) Close() error
Close stops the clock; nothing armed runs after it.
func (*SystemClock) Disarm ¶
func (c *SystemClock) Disarm()
Disarm forgets what was armed; a firing on its way finds nothing.
func (*SystemClock) Now ¶
func (c *SystemClock) Now() time.Time
Now is the time in the current zone.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package wallclocktest sets the time zone a wallclock.SystemClock under test watches.
|
Package wallclocktest sets the time zone a wallclock.SystemClock under test watches. |