Documentation ¶
Index ¶
- Constants
- Variables
- func CompareDate(t1, t2 time.Time, offsetFromUTC time.Duration) int
- func CompareDateUTC(t1, t2 time.Time) int
- func ParseDuration(s string) (time.Duration, error)
- func TimestampPass(timestamp, t int64) bool
- func UnixMicro(t time.Time) int64
- func UnixMilli(t time.Time) int64
- type Duration
- func (d Duration) D() time.Duration
- func (d Duration) Hours() float64
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d Duration) Microseconds() int64
- func (d Duration) Milliseconds() int64
- func (d Duration) Minutes() float64
- func (d Duration) Nanoseconds() int64
- func (d Duration) Round(m time.Duration) time.Duration
- func (d Duration) Seconds() float64
- func (d Duration) String() string
- func (d Duration) Truncate(m time.Duration) time.Duration
- func (this *Duration) UnmarshalJSON(data []byte) error
- type Stopwatch
- func (sw Stopwatch) Elapsed() time.Duration
- func (sw Stopwatch) ElapsedMilliseconds() float64
- func (sw Stopwatch) ElapsedMillisecondsSince(lapName string) float64
- func (sw Stopwatch) ElapsedSeconds() float64
- func (sw Stopwatch) ElapsedSecondsSince(lapName string) float64
- func (sw Stopwatch) ElapsedSince(lapName string) time.Duration
- func (this *Stopwatch) Lap(name string)
- func (sw Stopwatch) RangeReversedLaps(f func(name string, d time.Duration) bool)
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 CompareDateUTC ¶
func TimestampPass ¶
Types ¶
type Duration ¶
func (Duration) MarshalJSON ¶
func (Duration) Microseconds ¶
func (Duration) Milliseconds ¶
func (Duration) Nanoseconds ¶
func (*Duration) UnmarshalJSON ¶
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) ElapsedMilliseconds ¶
ElapsedMilliseconds returns the total elapsed milliseconds.
func (Stopwatch) ElapsedMillisecondsSince ¶
func (Stopwatch) ElapsedSeconds ¶
ElapsedSeconds returns the total elapsed seconds.
func (Stopwatch) ElapsedSecondsSince ¶
Click to show internal directories.
Click to hide internal directories.