utc

package
v0.0.0-...-4a740ba Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  protocol.Duration = 1
	Microsecond                   = 1000 * Nanosecond
	Millisecond                   = 1000 * Microsecond
	Second                        = 1000 * Millisecond
	Minute                        = 60 * Second
	Hour                          = 60 * Minute
	Day                           = 24 * Hour
	Week                          = 7 * Day

	// TropicalYear also known as a solar year - https://en.wikipedia.org/wiki/Tropical_year
	TropicalYear = (365 * 24 * 60 * 60) + (5 * 60 * 60) + (48 * 60) + 46 // 365.24219 * 24 * 60 * 60 = 31,556,925.216
)

Common durations.

Variables

This section is empty.

Functions

This section is empty.

Types

type DayElapsed

type DayElapsed int64 // utc.Now().DayElapsed()

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type DayHours

type DayHours uint32

A DayHours specifies a hour of a day.

const (
	DayHours_None DayHours = 0
	DayHours_0    DayHours = (1 << iota)
	DayHours_1
	DayHours_2
	DayHours_3
	DayHours_4
	DayHours_5
	DayHours_6
	DayHours_7
	DayHours_8
	DayHours_9
	DayHours_10
	DayHours_11
	DayHours_12
	DayHours_13
	DayHours_14
	DayHours_15
	DayHours_16
	DayHours_17
	DayHours_18
	DayHours_19
	DayHours_20
	DayHours_21
	DayHours_22
	DayHours_23
	DayHours_All DayHours = 0b11111111111111111111111111111111
)

Hours

func (DayHours) Check

func (dh DayHours) Check(hour DayHours) (exist bool)

Check given hour exist in given day hours

type HourElapsed

type HourElapsed int64 // utc.Now().HourElapsed()

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type MicroElapsed

type MicroElapsed int64

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type MilliElapsed

type MilliElapsed int64

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type MonthElapsed

type MonthElapsed int64 // utc.Now().MonthElapsed()

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type NanoElapsed

type NanoElapsed int64

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type SecElapsed

type SecElapsed int64 // utc.Now().SecondElapsed()

Elapsed types specified time elapsed of January 1 of the absolute year. January 1 of the absolute year(0001), like January 1 of 2001, was a Monday.

type Time

type Time struct {
	// contains filtered or unexported fields
}

func Now

func Now() (t Time)

func (Time) AddDuration

func (t Time) AddDuration(d protocol.Duration) (new Time)

AddDuration return given time plus given duration

func (Time) CallendarYearElapsed

func (t Time) CallendarYearElapsed() (year int64)

func (*Time) ChangeTo

func (t *Time) ChangeTo(sec SecElapsed, nsecElapsed int32)

func (Time) DayElapsed

func (t Time) DayElapsed() (day DayElapsed)

func (*Time) DayHours

func (t *Time) DayHours() (hour DayHours)

func (*Time) Epoch

func (t *Time) Epoch() protocol.TimeEpoch

func (Time) HourElapsed

func (t Time) HourElapsed() (hour HourElapsed)

func (*Time) Local

func (t *Time) Local() (loc Time)

Local change given time to local time by OS set time zone

func (Time) MicroElapsed

func (t Time) MicroElapsed() MicroElapsed

func (Time) MilliElapsed

func (t Time) MilliElapsed() MilliElapsed

func (Time) MonthElapsed

func (t Time) MonthElapsed() (month MonthElapsed)

func (Time) NanoElapsed

func (t Time) NanoElapsed() NanoElapsed

func (*Time) NanoSecondElapsed

func (t *Time) NanoSecondElapsed() int32

func (*Time) Now

func (t *Time) Now()

func (*Time) NowAtomic

func (t *Time) NowAtomic()

func (Time) Pass

func (t Time) Pass(from Time) (pass bool)

Pass check if time pass from given time

func (Time) SecElapsed

func (t Time) SecElapsed() SecElapsed

func (*Time) SecondElapsed

func (t *Time) SecondElapsed() int64

func (*Time) ToString

func (t *Time) ToString() string

func (Time) TropicalYearElapsed

func (t Time) TropicalYearElapsed() (year int64)

func (Time) Until

func (t Time) Until(to Time) (until Time)

Until return time duration until to given time!

func (Time) UntilTo

func (t Time) UntilTo(to Time) (duration protocol.Duration)

UntilTo return second duration until to given time!

func (*Time) Weekdays

func (t *Time) Weekdays() (day Weekdays)

type Weekdays

type Weekdays uint8

A Weekdays specifies a day of the week. can use by multiple state e.g. Weekdays_Saturday|Weekdays_Monday

const (
	Weekdays_None      Weekdays = 0b00000000
	Weekdays_Monday    Weekdays = 0b00000001
	Weekdays_Tuesday   Weekdays = 0b00000010
	Weekdays_Wednesday Weekdays = 0b00000100
	Weekdays_Thursday  Weekdays = 0b00001000
	Weekdays_Friday    Weekdays = 0b00010000
	Weekdays_Saturday  Weekdays = 0b00100000
	Weekdays_Sunday    Weekdays = 0b01000000
	Weekdays_All       Weekdays = 0b11111111
)

Weekdays

func (Weekdays) Check

func (w Weekdays) Check(day Weekdays) (exist bool)

Check given day exist in desire days

func (Weekdays) String

func (wd Weekdays) String() (day string)

Check given day exist in desire Weekdays!

Jump to

Keyboard shortcuts

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