leaseclock

package
v0.0.0-...-0b698e0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package leaseclock provides boot-scoped, suspend-inclusive lease deadlines. Wall timestamps are audit/display data; they do not grant elapsed entitlement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deadline

type Deadline struct {
	Version int       `json:"version"`
	Boot    string    `json:"boot"`
	Anchor  int64     `json:"anchor_ns"`
	End     int64     `json:"end_ns"`
	Wall    time.Time `json:"wall_expires"`
}

func New

func New(s Sample, ttl time.Duration) (*Deadline, error)

func (*Deadline) Remaining

func (d *Deadline) Remaining(s Sample, wall *time.Time) (time.Duration, error)

Remaining never rebases an old deadline onto a new boot or recovered clock.

type Sample

type Sample struct {
	Boot string    `json:"boot"`
	Tick int64     `json:"tick_ns"`
	Wall time.Time `json:"wall"`
}

func Read

func Read() (Sample, error)

CLOCK_BOOTTIME includes suspend. Linux time namespaces can offset it, so the current thread must prove the initial time namespace for restart continuity.

func (Sample) Valid

func (s Sample) Valid() bool

Jump to

Keyboard shortcuts

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