package timeext

import "github.com/go-playground/pkg/v5/time"

Index

Constants

const (
	// RFC3339Nano is a correct replacement to Go's current time.RFC3339Nano which is NOT sortable and
	// have no intention of fixing https://github.com/golang/go/issues/19635; this format fixes that.
	RFC3339Nano = "2006-01-02T15:04:05.000000000Z07:00"
)

Functions

func NanoTime

func NanoTime() int64

NanoTime returns the time from the monotonic clock in nanoseconds.

Types

type Instant

type Instant int64

Instant represents a monotonic instant in time.

Instants are opaque types that can only be compared with one another and allows measuring of duration.

func NewInstant

func NewInstant() Instant

NewInstant returns a new Instant.

func (Instant) Elapsed

func (i Instant) Elapsed() time.Duration

Elapsed returns the duration since the instant was created.

func (Instant) Since

func (i Instant) Since(instant Instant) time.Duration

Since returns the duration elapsed from another Instant, or zero is that Instant is later than this one.

Source Files

instant.go nanotime.go time.go

Version
v5.24.0
Published
Jan 21, 2024
Platform
darwin/amd64
Imports
2 packages
Last checked
4 seconds ago

Tools for package owners.