Documentation ¶
Index ¶
- Constants
- func CurrentMillis() int64
- func DaysDuration(days int) time.Duration
- func EpochMillsTime(millis int64) time.Time
- func EpochTime(secs int64) time.Time
- func HoursDuration(hours int) time.Duration
- func MicrosDuration(micros int) time.Duration
- func MillisDuration(millis int) time.Duration
- func MinutesDuration(minutes int) time.Duration
- func NanosDuration(nanos int) time.Duration
- func ParseLocal(layout string, value string) (time.Time, error)
- func SecondsDuration(seconds int) time.Duration
- func ToEpochMills(t time.Time) int64
- type Stopwatch
Constants ¶
const SimpleDate = "2006-01-02"
const SimpleTime = "2006-01-02 15:04:05"
const SimpleTimeMills = "2006-01-02 15:04:05.000"
Variables ¶
This section is empty.
Functions ¶
func CurrentMillis ¶ added in v1.0.1
func CurrentMillis() int64
CurrentMillis return unix mills timestamp for now
func DaysDuration ¶ added in v1.2.1
HoursDuration create time.Duration from hours
func EpochMillsTime ¶ added in v1.2.1
EpochMillsTime convert unix epoch mills to time
func HoursDuration ¶ added in v1.2.1
HoursDuration create time.Duration from hours
func MicrosDuration ¶ added in v1.2.1
MicrosDuration create time.Duration from micro seconds
func MillisDuration ¶ added in v1.2.1
MillisDuration create time.Duration from milli seconds
func MinutesDuration ¶ added in v1.2.1
MinutesDuration create time.Duration from minutes
func NanosDuration ¶ added in v1.2.1
NanosDuration create time.Duration from nano seconds
func ParseLocal ¶ added in v1.2.0
ParseLocal parse time string with layout, in local Location
func SecondsDuration ¶ added in v1.2.1
SecondsDuration create time.Duration from seconds
func ToEpochMills ¶
ToEpochMills convert time to unix epoch millis
Types ¶
type Stopwatch ¶ added in v1.0.1
type Stopwatch struct {
// contains filtered or unexported fields
}
Stopwatch for measure elapsed time. This class is NOT thread-safe.
func NewStopwatch ¶ added in v1.0.1
func NewStopwatch() *Stopwatch
NewStopwatch create new Stopwatch, not started.
func NewStopwatchStarted ¶ added in v1.0.1
func NewStopwatchStarted() *Stopwatch
NewStopwatchStarted create new Stopwatch, then start it.
func (*Stopwatch) Elapsed ¶ added in v1.0.1
Elapsed return elapsed time. If not started, always return zero; If started and not stopped, return time interval from begin time to now; If stopped, return elapsed time duration from started time to stopped time.