wtime

package
v0.0.0-...-bdd9120 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: BSD-3-Clause Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DateTimeFormat                   = "2006-01-02 15:04:05"
	CompactDateTimeFormat            = "20060102150405"
	CompactDateTimeFormatWithoutYear = "0102150405"
	DateFormat                       = "2006-01-02"
	TimeFormat                       = "15:04:05"
)
View Source
const Day = 24 * time.Hour

Variables

View Source
var (
	Unix1970 = time.Unix(0, 0).UTC()
)

Functions

func CompareDate

func CompareDate(t1, t2 time.Time, offsetFromUTC time.Duration) int

func CompareDateUTC

func CompareDateUTC(t1, t2 time.Time) int

func ParseDuration

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

func TimestampPass

func TimestampPass(timestamp, t int64) bool

func UnixMicro

func UnixMicro(t time.Time) int64

func UnixMilli

func UnixMilli(t time.Time) int64

Types

type Duration

type Duration time.Duration

func (Duration) D

func (d Duration) D() time.Duration

func (Duration) Hours

func (d Duration) Hours() float64

func (Duration) MarshalJSON

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

func (Duration) Microseconds

func (d Duration) Microseconds() int64

func (Duration) Milliseconds

func (d Duration) Milliseconds() int64

func (Duration) Minutes

func (d Duration) Minutes() float64

func (Duration) Nanoseconds

func (d Duration) Nanoseconds() int64

func (Duration) Round

func (d Duration) Round(m time.Duration) time.Duration

func (Duration) Seconds

func (d Duration) Seconds() float64

func (Duration) String

func (d Duration) String() string

func (Duration) Truncate

func (d Duration) Truncate(m time.Duration) time.Duration

func (*Duration) UnmarshalJSON

func (this *Duration) UnmarshalJSON(data []byte) error

type Stopwatch

type Stopwatch struct {
	// contains filtered or unexported fields
}

Stopwatch helps you measure elapsed time.

func NewStopwatch

func NewStopwatch() Stopwatch

NewStopwatch creates a new stopwatch instance and starts measuring elapsed time.

func (Stopwatch) Elapsed

func (sw Stopwatch) Elapsed() time.Duration

Elapsed returns the total elapsed time.

func (Stopwatch) ElapsedMilliseconds

func (sw Stopwatch) ElapsedMilliseconds() float64

ElapsedMilliseconds returns the total elapsed milliseconds.

func (Stopwatch) ElapsedMillisecondsSince

func (sw Stopwatch) ElapsedMillisecondsSince(lapName string) float64

func (Stopwatch) ElapsedSeconds

func (sw Stopwatch) ElapsedSeconds() float64

ElapsedSeconds returns the total elapsed seconds.

func (Stopwatch) ElapsedSecondsSince

func (sw Stopwatch) ElapsedSecondsSince(lapName string) float64

func (Stopwatch) ElapsedSince

func (sw Stopwatch) ElapsedSince(lapName string) time.Duration

func (*Stopwatch) Lap

func (this *Stopwatch) Lap(name string)

func (Stopwatch) RangeReversedLaps

func (sw Stopwatch) RangeReversedLaps(f func(name string, d time.Duration) bool)

Jump to

Keyboard shortcuts

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