cockroach: github.com/cockroachdb/cockroach/pkg/util/timeofday Index | Files

package timeofday

import "github.com/cockroachdb/cockroach/pkg/util/timeofday"

Index

Package Files

time_of_day.go

Constants

const (
    // Min is the minimum TimeOfDay value (midnight).
    Min = TimeOfDay(0)

    // Max is the maximum TimeOfDay value (1 second before midnight)
    Max = TimeOfDay(microsecondsPerDay - 1)

    // Time2400 is a special value to represent the 24:00 input time
    Time2400 = TimeOfDay(microsecondsPerDay)
)

func Difference Uses

func Difference(t1 TimeOfDay, t2 TimeOfDay) duration.Duration

Difference returns the interval between t1 and t2, which may be negative.

type TimeOfDay Uses

type TimeOfDay int64

TimeOfDay represents a time of day (no date), stored as microseconds since midnight.

func FromInt Uses

func FromInt(i int64) TimeOfDay

FromInt constructs a TimeOfDay from an int64, representing microseconds since midnight. Inputs outside the range [0, microsecondsPerDay) are modded as appropriate.

func FromTime Uses

func FromTime(t time.Time) TimeOfDay

FromTime constructs a TimeOfDay from a time.Time, ignoring the date and time zone.

func New Uses

func New(hour, min, sec, micro int) TimeOfDay

New creates a TimeOfDay representing the specified time.

func Random Uses

func Random(rng *rand.Rand) TimeOfDay

Random generates a random TimeOfDay.

func (TimeOfDay) Add Uses

func (t TimeOfDay) Add(d duration.Duration) TimeOfDay

Add adds a Duration to a TimeOfDay, wrapping into the next day if necessary.

func (TimeOfDay) Hour Uses

func (t TimeOfDay) Hour() int

Hour returns the hour specified by t, in the range [0, 24].

func (TimeOfDay) Microsecond Uses

func (t TimeOfDay) Microsecond() int

Microsecond returns the microsecond offset within the second specified by t, in the range [0, 999999].

func (TimeOfDay) Minute Uses

func (t TimeOfDay) Minute() int

Minute returns the minute offset within the hour specified by t, in the range [0, 59].

func (TimeOfDay) Second Uses

func (t TimeOfDay) Second() int

Second returns the second offset within the minute specified by t, in the range [0, 59].

func (TimeOfDay) String Uses

func (t TimeOfDay) String() string

func (TimeOfDay) ToTime Uses

func (t TimeOfDay) ToTime() time.Time

ToTime converts a TimeOfDay to a time.Time, using the Unix epoch as the date.

Package timeofday imports 6 packages (graph) and is imported by 11 packages. Updated 2019-07-13. Refresh now. Tools for package owners.