Help us shape the future of Go! Take the 2026 Go Developer Survey

time

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NowAddDateMilliseconds

func NowAddDateMilliseconds(year int, month int, day int) int64

NowAddDateMilliseconds adds year, month, day to a date and returns the milliseconds

func NowMilliseconds

func NowMilliseconds() int64

NowMilliseconds returns a unix timestamp (int64) in milliseconds

func ParseRFC3339Offset

func ParseRFC3339Offset(dateString string) (offsetSeconds int64, e error)

ParseRFC3339Offset parses an RFC3339 and returns its offset in seconds

func ToMilliseconds

func ToMilliseconds(t time.Time) int64

ToMilliseconds converts a time to milliseconds

Types

type ITime

type ITime interface {
	NowMilliseconds() int64
}

type StopWatch

type StopWatch struct {
	Total *StopWatchStep
	// contains filtered or unexported fields
}

StopWatch is a multi-step timer for measuring execution time of functions, utils.

func NewStopWatch

func NewStopWatch() *StopWatch

NewStopWatch creates a new StopWatch

func (*StopWatch) CurrentStep

func (t *StopWatch) CurrentStep() *StopWatchStep

CurrentStep returns the current step

func (*StopWatch) Finish

func (t *StopWatch) Finish()

Finish finishes the stop watch

func (*StopWatch) FinishStep

func (t *StopWatch) FinishStep()

FinishStep finishes the current step (if exists)

func (*StopWatch) Print

func (t *StopWatch) Print()

Print prints stats to stdout

func (*StopWatch) Step

func (t *StopWatch) Step(name string)

Step creates a new step inside stopWatchMgr

type StopWatchStep

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

StopWatchStep is a timer container

func NewStopWatchStep

func NewStopWatchStep(name string) *StopWatchStep

NewStopWatchStep returns a new stopWatch step

func (*StopWatchStep) Finish

func (t *StopWatchStep) Finish()

Finish ends the stop watch

func (*StopWatchStep) Milliseconds

func (t *StopWatchStep) Milliseconds() float64

Milliseconds returns the step time in Milliseconds

func (*StopWatchStep) Start

func (t *StopWatchStep) Start()

Start starts the stop watch

func (*StopWatchStep) String

func (t *StopWatchStep) String() string

String() returns a human readable result of the stop watch

Jump to

Keyboard shortcuts

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