clock

package
v0.0.0-...-48aa4a7 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emulator

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

Emulator is a device which you can use to simulate a slower computer's clockspeed.

func NewEmulator

func NewEmulator(hz int64) *Emulator

NewEmulator returns a new emulator based on some number of hertz

func (*Emulator) WaitForCycles

func (e *Emulator) WaitForCycles(cycles int64, waitFunc func(d time.Duration))

WaitForCycles will wait for a period of time that would allow the emulator to slow down the current thread based on its hertz. Whatever "waiting" means is up to the caller. Note that this function is not perfect; I've observed situations where the cycle rate can overclock a bit. The point is merely to get close to the correct rate.

Jump to

Keyboard shortcuts

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