clock

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: BSD-2-Clause Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package clock provides the timing source a pipeline uses for presentation timestamps and elapsed-time measurements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Start fixes the clock's reference point. It must be called before Time.
	Start()
	// Time is the elapsed time since Start. It is 0 before Start is called.
	Time() time.Duration
}

Clock is a timing source for a pipeline. Start fixes the reference point and Time reports the elapsed time since then. The unit and reference are defined by the implementation.

type System

type System struct {
	// contains filtered or unexported fields
}

System is a monotonic Clock backed by the host's monotonic time, so it is unaffected by wall-clock adjustments. The zero value is not usable; build one with NewSystem. It is safe for concurrent use.

func NewSystem

func NewSystem() *System

NewSystem returns a System clock that has not been started yet.

func (*System) Start

func (c *System) Start()

Start records the current monotonic time as the reference for Time.

func (*System) Time

func (c *System) Time() time.Duration

Time returns the elapsed time since Start, or 0 if the clock has not been started yet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL