package epoch

import "github.com/containerd/containerd/pkg/epoch"

Package epoch provides SOURCE_DATE_EPOCH utilities.

Index

Constants

const SourceDateEpochEnv = "SOURCE_DATE_EPOCH"

SourceDateEpochEnv is the SOURCE_DATE_EPOCH env var. See https://reproducible-builds.org/docs/source-date-epoch/

Functions

func FromContext

func FromContext(ctx context.Context) *time.Time

FromContext returns the epoch associated with the context. FromContext does not fall back to read the SOURCE_DATE_EPOCH env var.

func SetSourceDateEpoch

func SetSourceDateEpoch(tm time.Time)

SetSourceDateEpoch sets the SOURCE_DATE_EPOCH env var.

func SourceDateEpoch

func SourceDateEpoch() (*time.Time, error)

SourceDateEpoch returns the SOURCE_DATE_EPOCH env var as *time.Time. If the env var is not set, SourceDateEpoch returns nil without an error.

func SourceDateEpochOrNow

func SourceDateEpochOrNow() time.Time

SourceDateEpochOrNow returns the SOURCE_DATE_EPOCH time if available, otherwise returns the current time.

func UnsetSourceDateEpoch

func UnsetSourceDateEpoch()

UnsetSourceDateEpoch unsets the SOURCE_DATE_EPOCH env var.

func WithSourceDateEpoch

func WithSourceDateEpoch(ctx context.Context, tm *time.Time) context.Context

WithSourceDateEpoch associates the context with the epoch.

Source Files

context.go epoch.go

Version
v1.7.7
Published
Oct 9, 2023
Platform
js/wasm
Imports
6 packages
Last checked
1 hour ago

Tools for package owners.