unixtime

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Until

func Until(u Unixtime) time.Duration

Until returns the time.Duration from now until an Unixtime

func VerifyTime

func VerifyTime(iat, exp *Unixtime) error

VerifyTime verifies the iat and exp times with regard to the current time

Types

type DurationInSeconds

type DurationInSeconds struct {
	time.Duration
}

DurationInSeconds is a type for handling time.Duration expressed in seconds

func NewDurationInSeconds

func NewDurationInSeconds(seconds float64) DurationInSeconds

NewDurationInSeconds returns a DurationInSeconds from a number of seconds

func (DurationInSeconds) MarshalJSON

func (d DurationInSeconds) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (DurationInSeconds) MarshalYAML

func (d DurationInSeconds) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*DurationInSeconds) UnmarshalJSON

func (d *DurationInSeconds) UnmarshalJSON(src []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*DurationInSeconds) UnmarshalYAML

func (d *DurationInSeconds) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Unixtime

type Unixtime struct {
	time.Time
}

Unixtime is a type for handling unix timestamps

func Now

func Now() Unixtime

func (Unixtime) MarshalJSON

func (u Unixtime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Unixtime) UnmarshalJSON

func (u *Unixtime) UnmarshalJSON(src []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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