clock

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

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