epoch

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Overview

Package epoch provides SOURCE_DATE_EPOCH utilities.

Index

Constants

View Source
const SourceDateEpochEnv = "SOURCE_DATE_EPOCH"

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

Variables

This section is empty.

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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