time2

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DATETIME_FMT = "2006/01/02 15:04:05"
View Source
const DATE_FMT = "2006/01/02"
View Source
const (
	ErrWrongHumanTimeFormat = errors.Err("wrong human time format")
)
View Source
const TIME_FMT = "15:04:05"

Variables

This section is empty.

Functions

func Date

func Date() string

Date return current date in format: yyyy/mm/dd

func DateAndTime added in v0.2.2

func DateAndTime() (string, string)

func DateTime

func DateTime() string

DateTime return curremt datetime in format yyyy/mm/dd HH:MM:SS

func IsLeapYear added in v0.2.2

func IsLeapYear(year int) bool

IsLeapYear check whether a year is leay

func MonthDays added in v0.2.2

func MonthDays(year, month int) int

MonthDays return days of the month/year

func NowTimeUnix

func NowTimeUnix() uint64

NowTimeUnix is a wrapper of time.Now().Unix()

func NowTimeUnixNano

func NowTimeUnixNano() uint64

NowTimeUnixNano is a wrapper of time.Now().UnixNano()

func ParseHuman

func ParseHuman(timestr string) (time.Duration, error)

ParseHuman convert human time format to duration. support:

'H': hour,
'M': minute,
'S': second,
'm': millsecond,
'u': microsecond,
'n': nanosecond

func Time

func Time() string

Time return current time in format HH:MM:SS

func Timing

func Timing(f func()) int64

Timing the cost of function call, unix nano was returned

func ToHuman

func ToHuman(nano int64) string

ToHuman convert nano to human time size, insufficient portion will be discarded performs rounding.

support 0-999ns, 0-999us, 0-999ms, 0-Maxs,

func UnixNanoSinceNow

func UnixNanoSinceNow(sec int) int64

Types

This section is empty.

Jump to

Keyboard shortcuts

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