boottimer

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package boottimer provides a one-shot timer whose deadline keeps counting across system suspend. On Linux the Go runtime's monotonic clock pauses while the system sleeps, so timers fire late by the suspended duration (https://github.com/golang/go/issues/24595); the timer is backed by a CLOCK_BOOTTIME timerfd there. Other platforms fall back to a standard timer: exact on FreeBSD, whose CLOCK_MONOTONIC counts suspended time (see clock_gettime(2)), best-effort where the clock pauses, such as macOS (https://github.com/golang/go/issues/66870).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timer

type Timer struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

Timer fires on C once per arming. Reset re-arms and drains any undelivered fire, but a fire racing a concurrent Reset can still slip through, so treat C as a wake-up hint and re-check the deadline.

func New

func New(d time.Duration) *Timer

func (*Timer) Reset

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

func (*Timer) Stop

func (t *Timer) Stop()

Stop releases the timer's resources; the timer is unusable afterwards.

Jump to

Keyboard shortcuts

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