time

package
v1.452.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Minute represents 60 seconds.
	//nolint:revive
	Minute = time.Minute

	// Second represents 1 second.
	//nolint:revive
	Second = time.Second

	// RFC3339 formats time to 2006-01-02T15:04:05Z07:00.
	RFC3339 = time.RFC3339
)

Variables

Module for fx.

View Source
var Now = time.Now

Now is just an alias to time.Now.

Functions

func IsEnabled added in v1.176.0

func IsEnabled(cfg *Config) bool

IsEnabled for time.

func MustParseDuration added in v1.150.0

func MustParseDuration(s string) time.Duration

MustParseDuration for time.

func ParseDuration added in v1.426.0

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string.

Types

type Config added in v1.176.0

type Config struct {
	Kind    string `yaml:"kind,omitempty" json:"kind,omitempty" toml:"kind,omitempty"`
	Address string `yaml:"address,omitempty" json:"address,omitempty" toml:"address,omitempty"`
}

Config for time.

func (*Config) IsNTP added in v1.179.0

func (c *Config) IsNTP() bool

IsNTP for configuration.

func (*Config) IsNTS added in v1.179.0

func (c *Config) IsNTS() bool

IsNTS for configuration.

type Duration added in v1.426.0

type Duration = time.Duration

Duration represents the elapsed time between two instants.

func Since

func Since(t time.Time) Duration

Since is the time elapsed since t.

type Network added in v1.179.0

type Network interface {
	// Now from the network.
	Now() (Time, error)
}

Network for time.

func NewNetwork added in v1.179.0

func NewNetwork(cfg *Config) Network

NewNetwork for time.

type Time added in v1.426.0

type Time = time.Time

Time represents an instant in time with nanosecond precision.

Jump to

Keyboard shortcuts

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