Documentation ¶
Overview ¶
Package clock displays a clock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents a clock bar module. It supports setting the click handler, timezone, output format, and granularity.
func Local ¶
func Local() *Module
Local constructs a clock module for the current machine's timezone.
func Zone ¶
Zone constructs a clock module for the given timezone.
func ZoneByName ¶
ZoneByName constructs a clock module for the given zone name, (e.g. "America/Los_Angeles"), and returns any errors.
func (*Module) Output ¶
func (m *Module) Output( granularity time.Duration, outputFunc func(time.Time) bar.Output, ) *Module
Output configures a module to display the output of a user-defined function.
The first argument configures the granularity at which the module should refresh. For example, if the format does not have seconds, it should be time.Minute.
The module will always update at the next second, minute, hour, etc., so large granularities will not negatively affect the output due to drift.
Additionally, the module will automatically update when discontinuous change of clock occurs, due to e.g. system suspend or clock adjustments.
func (*Module) OutputFormat ¶
OutputFormat configures a module to display the time in a given format.