timecmd

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sleep

func Sleep(d time.Duration)

Sleep pauses execution for the specified duration

func SleepSeconds

func SleepSeconds(seconds float64)

SleepSeconds pauses execution for the specified number of seconds

Types

type Stopwatch

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

Stopwatch provides a simple timing utility

func NewStopwatch

func NewStopwatch() *Stopwatch

NewStopwatch creates a new stopwatch

func (*Stopwatch) Elapsed

func (s *Stopwatch) Elapsed() time.Duration

Elapsed returns the total elapsed time

func (*Stopwatch) Lap

func (s *Stopwatch) Lap() time.Duration

Lap records a lap time

func (*Stopwatch) Laps

func (s *Stopwatch) Laps() []time.Duration

Laps returns all recorded laps

func (*Stopwatch) Reset

func (s *Stopwatch) Reset()

Reset resets the stopwatch

type TimeResult

type TimeResult struct {
	Real     time.Duration `json:"real"`
	User     time.Duration `json:"user"` // Approximated as real for Go
	Sys      time.Duration `json:"sys"`  // Not available in pure Go
	ExitCode int           `json:"exitCode"`
}

TimeResult represents the timing result of an operation

func RunTime

func RunTime(w io.Writer, fn func() error) (TimeResult, error)

RunTime measures execution time of a function Since omni doesn't exec external commands, this is used as a timing utility

Jump to

Keyboard shortcuts

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