clock

package
v0.0.0-...-be6f5f5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DayUnit is a unit code for day
	DayUnit = Unit("d")
	// WeekUnit is a unit code for week
	WeekUnit = Unit("w")
	// MonthUnit is a unit code for month
	MonthUnit = Unit("m")
)
View Source
const UnitZero = UnitNum(0)

UnitZero is zero UnitNum

Variables

This section is empty.

Functions

func Custom

func Custom(f func() time.Time)

Custom replaces a current time function with custome f for clocks now

func Now

func Now() time.Time

Now returns clocks now

func Reset

func Reset()

Reset resets now function to get real current time

func Static

func Static(t time.Time)

Static fixes clocks now function to return value t

func ValidUnit

func ValidUnit(unit Unit) error

Types

type Unit

type Unit string

Unit represents a unit of time, like day, hour, year and etc.

type UnitNum

type UnitNum uint32

UnitNum is a value of particular Unit from the zero unix time, for example 3d week or 2nd year

func DayNum

func DayNum() UnitNum

DayNum return current day number

func DayNumOf

func DayNumOf(t time.Time) UnitNum

DayNumOf returns day number of specified time t

func MonthNum

func MonthNum() UnitNum

MonthNum return current month number

func MonthNumOf

func MonthNumOf(t time.Time) UnitNum

MonthNumOf returns month number of specified time t

func WeekNum

func WeekNum() UnitNum

WeekNum return current week number

func WeekNumOf

func WeekNumOf(t time.Time) UnitNum

WeekNumOf returns week number of specified time t

Jump to

Keyboard shortcuts

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