Documentation
¶
Index ¶
- Constants
- type Duration
- type Fly
- func (f *Fly) Add(d interface{}) (*Fly, error)
- func (f *Fly) Ceil(name string) (*Fly, error)
- func (f *Fly) Floor(name string) (*Fly, error)
- func (f *Fly) Humanize() string
- func (f *Fly) Microsecond() int
- func (f *Fly) Millisecond() int
- func (f *Fly) Nanosecond() int
- func (f *Fly) String() string
- func (f *Fly) To(name string) (*Fly, error)
- func (f *Fly) Zone() (string, int)
Constants ¶
const ( Nanosecond time.Duration = 1 Microsecond = 1000 * Nanosecond Millisecond = 1000 * Microsecond Second = 1000 * Millisecond Minute = 60 * Second Hour = 60 * Minute Day = 24 * Hour Week = 7 * Day )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration represents the elapsed time between two instants as an int64 nanosecond count.
func ParseDuration ¶
ParseDuration parses a duration string
func (*Duration) Nanoseconds ¶
Nanoseconds returns the duration as an integer nanosecond count
type Fly ¶
type Fly struct {
// contains filtered or unexported fields
}
Fly is the main data struct
func (*Fly) Add ¶
Add moves the time forward by certain mount of duration. Parameter can be either `time.Duration` instance or time string such as "300ms", "-1.5h", "2h 45m"(spaces are handled carefully), each with a decimal number and a time unit. Valid time units are "ns", "us", "ms", "s", "m", "h".
Note that you can move time backward by setting the value to negative, like `time.Duration(-5 * time.Hour)`, or `-5h`. If parameter can not be parsed as duration, an error will be returned
func (*Fly) Ceil ¶
Ceil returns the result of time ceil of certain unit. Parameter should be hour, minute, second, microsecond, If unit is negative, Ceil returns time unchanged
func (*Fly) Floor ¶
Floor returns the result of time floor of certain unit. Parameter should be hour, minute, second, microsecond, If unit is negative, Floor returns time unchanged
func (*Fly) Microsecond ¶
Microsecond returns current time milliseconds value
func (*Fly) Millisecond ¶
Millisecond returns current time milliseconds value
func (*Fly) Nanosecond ¶
Nanosecond returns current time milliseconds value Note: Nanosecond is in the range [0, 999999999], which includes seconds and microseconds.