stattime

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package stattime provides time comparison functions that work with times up to the finest common precision. such as a file's modification time in a file system and a time.Time value from time.Now(). Slight warning: there's a chance of false positives when comparing times from different sources especially when the one of the times happen to be at the exact boundary of the precision.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(a, b time.Time) bool

After returns true if a is after b up to common time resolution.

func Before

func Before(a, b time.Time) bool

Before returns true if a is before b up to common time resolution.

func Equal

func Equal(timeA, timeB time.Time) bool

Equal returns true if the times are equal up to common time resolution.

func MinPrecision

func MinPrecision(a, b time.Time) time.Duration

MinPrecision returns the maximum precision of the given two times.

func Precision

func Precision(t time.Time) time.Duration

Precision returns the precision of the given time as a time.Duration.

func Truncate

func Truncate(a, b time.Time) (newA time.Time, newB time.Time)

Truncate both of the given times to the common max precision.

Types

This section is empty.

Jump to

Keyboard shortcuts

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