realtime

package module
v0.0.0-...-6bd3bc9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 8 Imported by: 0

README

Suspend-aware monotonic timers in pure Go

This "realtime" package is proof of concept for real time timers proposal. Package implements part of Go standard library time package functionality using platform specific APIS.

✅ - Done.

❎ - Works, but could be missing something or need improvements.

❌ - Not started yet.

API Darwin/BSD Linux Windows
realtime.Now() ✅️ ✅️
realtime.Since(u time.Duration) ✅️
realtime.Sleep(d time.Duration) ❎️ ❎️
realtime.AfterFunc(d time.Duration, f func()) ❎️
realtime.After(d time.Duration) ❎️ ❎️
realtime.NewTimer(d time.Duration) ❎️ ❎️
realtime.Tick(d time.Duration) ❎️ ❎️
realtime.NewTicker(d time.Duration) ❎️ ❎️

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(d time.Duration) <-chan Time

func Since

func Since(u Time) time.Duration

func Sleep

func Sleep(d time.Duration)

func Tick

func Tick(d time.Duration) <-chan Time

Types

type Ticker

type Ticker struct {
	C chan Time
	// contains filtered or unexported fields
}

func NewTicker

func NewTicker(d time.Duration) *Ticker

func (*Ticker) Stop

func (t *Ticker) Stop()

func (*Ticker) String

func (t *Ticker) String() string

type Time

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

func Now

func Now() Time

func (Time) Add

func (t Time) Add(d time.Duration) Time

func (Time) After

func (t Time) After(u Time) bool

func (Time) Before

func (t Time) Before(u Time) bool

func (Time) Nano

func (t Time) Nano() time.Duration

func (Time) String

func (t Time) String() string

func (Time) Sub

func (t Time) Sub(u Time) time.Duration

type Timer

type Timer struct {
	C chan Time
	// contains filtered or unexported fields
}

func AfterFunc

func AfterFunc(d time.Duration, f func()) *Timer

func NewTimer

func NewTimer(d time.Duration) *Timer

func (*Timer) Reset

func (t *Timer) Reset(d time.Duration) bool

func (*Timer) Stop

func (t *Timer) Stop() bool

func (*Timer) String

func (t *Timer) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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