Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a stopwatch
Service increments the currentTime anytime the attached TickerInterface ticks and running is true. Service uses Go's monotonic clock to generate diffs between the startTime and ticker current time to increment currentTime
func NewService ¶
func NewService(t TickerInterface) (*Service, chan time.Duration)
NewService returns a Service and a channel that sends the currentTime at approximately 60 FPS.
func (*Service) GetCurrentTime ¶
GetCurrentTime allows public read access to the currentTime
func (*Service) GetCurrentTimeFormatted ¶
GetCurrentTimeFormatted returns a frontend friendly string representing the current accumulated time.
func (*Service) Pause ¶
func (s *Service) Pause()
Pause freezes the current time, and sets the running state to false so ticker updates stop accumulating.
func (*Service) Reset ¶
func (s *Service) Reset()
Reset sets the running state to false, stopping the ticker updates from accumulating then sets the current time to 0.
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker wraps time.Ticker to allow DI for testing
type TickerInterface ¶
TickerInterface wraps time.Ticker to allow DI for testing