Documentation ¶
Overview ¶
timeutil provides a set of time utilities including comparisons, conversion to "DT8" int32 and "DT14" int64 formats and other capabilities.
Index ¶
- Constants
- Variables
- func AnyStringToQuarterTime(yyyyqSrcStr string) time.Time
- func DayStart(dt time.Time) time.Time
- func DaysAgoDow(baseDow int, wantDow int, wantInclusive bool) (int, error)
- func DaysAgoDowStrings(baseDowS string, wantDowS string, wantInclusive bool) (int, error)
- func DaysToDow(baseDow int, wantDow int, wantInclusive bool) (int, error)
- func DaysToDowStrings(baseDowS string, wantDowS string, wantInclusive bool) (int, error)
- func Dd6ToTime(dd6 string, reverse bool) (time.Time, error)
- func DeltaQuarterInt32(yyyyq int32, numQuarters int) (int32, error)
- func DeltaQuarters(dt time.Time, num int) time.Time
- func Distinct(times []time.Time) []time.Time
- func Dt14ForInts(yyyy, mm, dd, hr, mn, dy int) int64
- func Dt14ForString(layout, value string) (int64, error)
- func Dt14ForTime(t time.Time) int64
- func Dt14Now() int64
- func Dt6ForDt14(dt14 int64) int32
- func Dt6ForTime(dt time.Time) int32
- func Dt6MinMaxSlice(minDt6 int32, maxDt6 int32) []int32
- func Dt8ForInts(yyyy, mm, dd int) int32
- func Dt8ForString(layout, value string) (int32, error)
- func Dt8ForTime(t time.Time) int32
- func Dt8Now() int32
- func DurationDays(d time.Duration) float64
- func DurationDaysInt64(dur time.Duration) int64
- func DurationForNowSubDt8(dt8 int32) (time.Duration, error)
- func DurationFromProtobuf(pdur *duration.Duration) time.Duration
- func DurationIsZero(dur time.Duration) bool
- func DurationStringMinutesSeconds(durationSeconds int64) (string, error)
- func DurationYears(d time.Duration) float64
- func DurationZero() time.Duration
- func Earliest(times []time.Time, skipZeroes bool) (time.Time, error)
- func EqualQuarter(dt1, dt2 time.Time) bool
- func FirstDayOfISOWeek(year int, week int, timezone *time.Location) time.Time
- func FirstNonZeroTime(times ...time.Time) (time.Time, error)
- func FirstNonZeroTimeParsed(format string, times []string) (time.Time, error)
- func FormatDurationInfoMinSec(di DurationInfo) string
- func FormatQuarter(t time.Time) string
- func FormatQuarterYYQ(t time.Time) string
- func FormatQuarterYYYYQ(t time.Time) string
- func FormatTimeMulti(dateFormat string, v interface{}) string
- func FormatTimeToString(format string) func(time.Time) string
- func FromTo(value, fromLayout, toLayout string) (string, error)
- func FromTo2(fromLayout, toLayout, value string) (string, error)
- func FromToFirstValue(fromLayout, toLayout string, values []string) (string, error)
- func FromToFirstValueOrEmpty(fromLayout, toLayout string, values []string) string
- func GetFormat(formatName string) (string, error)
- func GreaterTime(t1, t2 time.Time) time.Time
- func InQuarter(dt time.Time, yyyyq int32) (bool, error)
- func InQuarterRange(dt time.Time, yyyyq1, yyyyq2 int32) (bool, error)
- func InQuarterTime(dt, qtr time.Time) bool
- func InRange(rangeStart, rangeEnd, needle time.Time, incStart, incEnd bool) bool
- func IntToBaseXString(baseX, val int) string
- func IntervalStart(dt time.Time, interval Interval, dow time.Weekday) (time.Time, error)
- func IsGreaterThan(timeLeft time.Time, timeRight time.Time, orEqual bool) bool
- func IsLessThan(timeLeft time.Time, timeRight time.Time, orEqual bool) bool
- func IsQuarterInt32(q int32) bool
- func IsQuarterStart(t time.Time) bool
- func IsYearStart(dt time.Time) bool
- func IsZero(u time.Time) bool
- func IsZeroAny(u time.Time) bool
- func Latest(times []time.Time, skipZeroes bool) (time.Time, error)
- func LesserTime(t1, t2 time.Time) time.Time
- func MaxDuration(durs []time.Duration) time.Duration
- func MaxInt32(ints []int32) int32
- func MaxTime(t, max time.Time) time.Time
- func MinInt32(ints []int32) int32
- func MinMax(min, max time.Time) (time.Time, time.Time)
- func MinMaxInt32(ints []int32) (int32, int32)
- func MinTime(t, min time.Time) time.Time
- func MonthNames() []string
- func MonthStart(dt time.Time) time.Time
- func MonthToQuarter(month uint8) uint8
- func MustFirstNonZeroTime(times ...time.Time) time.Time
- func MustInQuarter(dt time.Time, yyyyq int32) bool
- func MustInQuarterRange(dt time.Time, yyyyq1, yyyyq2 int32) bool
- func MustParse(layout, value string) time.Time
- func MustParseDuration(s string) time.Duration
- func NewDurationDays(days uint16) time.Duration
- func NewDurationSeconds(secs float64) time.Duration
- func NewDurationStrings(h, m, s string) (time.Duration, error)
- func NextDt6(dt6 int32) int32
- func NextQuarter(dt time.Time) time.Time
- func NextQuarterInt32(yyyyq int32) (int32, error)
- func NextQuarters(dt time.Time, num uint) time.Time
- func NextWeekday(dow time.Weekday) time.Time
- func NextYearStart(dt time.Time) time.Time
- func NowDeltaDuration(d time.Duration) time.Time
- func NowDeltaParseDuration(s string) (time.Time, error)
- func NumQuartersInt32(start, end int32) (int, error)
- func OffsetFormat(offset int, useColon, useZ bool) string
- func ParseDayOfWeek(value string) (int, error)
- func ParseDt6(dt6 int32) (int16, int8)
- func ParseDuration(s string) (time.Duration, error)
- func ParseFirst(layouts []string, value string) (time.Time, error)
- func ParseFirstValue(layout string, values []string) (time.Time, error)
- func ParseFirstValueOrZero(layout string, values []string) time.Time
- func ParseHalf(yyyyh int32) (int32, uint8, error)
- func ParseOrZero(layout, value string) time.Time
- func ParseQuarterInt32(yyyyq int32) (int32, uint8, error)
- func ParseQuarterInt32StartEndTimes(yyyyq int32) (time.Time, time.Time, error)
- func ParseQuarterStringStartTime(yyyyqStr string) (time.Time, error)
- func ParseSlice(layout string, strings []string) ([]time.Time, error)
- func ParseTimeSQLTimestampUsingOffset(timeStr string, offset int) (time.Time, error)
- func ParseTimeUsingOffset(format, raw, sep string, offset int, useColon, useZ bool) (time.Time, error)
- func ParseWeekday(s string) (time.Weekday, error)
- func PrevDt6(dt6 int32) int32
- func PrevQuarter(dt time.Time) time.Time
- func PrevQuarters(dt time.Time, num uint) time.Time
- func QuarterDuration(dt time.Time) time.Duration
- func QuarterEnd(dt time.Time) time.Time
- func QuarterInt32End(yyyyq int32) (time.Time, error)
- func QuarterInt32EndTime(yyyyq int32) (time.Time, error)
- func QuarterInt32ForTime(dt time.Time) int32
- func QuarterInt32Now() int32
- func QuarterInt32StartTime(yyyyq int32) (time.Time, error)
- func QuarterInt32Timeline(ints []int32) ([]int32, error)
- func QuarterInt32ToYear(yyyyq int32) int32
- func QuarterProjection(dt time.Time, current float64) float64
- func QuarterSlice(min, max time.Time) []time.Time
- func QuarterStart(dt time.Time) time.Time
- func QuarterStartString(dt time.Time) string
- func QuarterStringEndTime(yyyyqStr string) (time.Time, error)
- func QuarterStringStartTime(yyyyqStr string) (time.Time, error)
- func QuarterToMonth(quarter uint8) uint8
- func QuartersInt32RelToAbs(begin, end int32) (int32, int32)
- func SliceMinMax(times []time.Time) (time.Time, time.Time)
- func Sort(times []time.Time) []time.Time
- func SubDuration(dur1, dur2 time.Duration) time.Duration
- func SumDurations(durations ...time.Duration) time.Duration
- func TimeDeltaDow(base time.Time, wantDow time.Weekday, deltaUnits int, wantInclusive bool, ...) (time.Time, error)
- func TimeDeltaDowInt(base time.Time, wantDow int, deltaUnits int, wantInclusive bool, ...) (time.Time, error)
- func TimeDeltaDowString(base time.Time, wantDowS string, deltaUnits int, wantInclusive bool, ...) (time.Time, error)
- func TimeDt4AddNYears(dt time.Time, numYears int) time.Time
- func TimeDt6AddNMonths(dt time.Time, numMonths int) time.Time
- func TimeDt6SubNMonths(dt time.Time, numMonths int) time.Time
- func TimeForDt14(dt14 int64) (time.Time, error)
- func TimeForDt6(dt6 int32) (time.Time, error)
- func TimeForDt8(dt8 int32) (time.Time, error)
- func TimeIsZeroAny(u time.Time) bool
- func TimeMinRFC3339() time.Time
- func TimeSeriesMinMax(interval Interval, min, max time.Time) []time.Time
- func TimeSeriesSlice(interval Interval, times []time.Time) []time.Time
- func TimeSliceMinMax(times []time.Time) (time.Time, time.Time, error)
- func TimeToDd6(dt time.Time, reverse bool) (string, error)
- func TimeWithin(this, beg, end time.Time, eqBeg, eqEnd bool) bool
- func TimeZeroRFC3339() time.Time
- func TimeZeroUnix() time.Time
- func UnixMillis(epochMillis int64) time.Time
- func UnixToDay(epoch int64) time.Time
- func WeekStart(dt time.Time, dow time.Weekday) (time.Time, error)
- func YearEnd(dt time.Time) time.Time
- func YearStart(dt time.Time) time.Time
- type DurationInfo
- type DurationPct
- type Event
- type ISO8601NoTzMilliTime
- type ImpactPct
- type Interval
- type QuarterTimeline
- type RFC3339YMDTime
- type TimeMeta
- type TimeMore
- func (tm *TimeMore) DOW() time.Weekday
- func (tm *TimeMore) MonthStart() time.Time
- func (tm *TimeMore) Quarter() int32
- func (tm *TimeMore) QuarterEnd() time.Time
- func (tm *TimeMore) QuarterStart() time.Time
- func (tm *TimeMore) Time() time.Time
- func (tm *TimeMore) WeekStart() time.Time
- func (tm *TimeMore) Year() int32
- func (tm *TimeMore) YearEnd() time.Time
- func (tm *TimeMore) YearStart() time.Time
- type TimeRange
- func (tr *TimeRange) Duration() time.Duration
- func (tr *TimeRange) HasIntersection(tr2 TimeRange) bool
- func (tr *TimeRange) Insert(t time.Time)
- func (tr *TimeRange) InsertMax(t time.Time)
- func (tr *TimeRange) InsertMin(t time.Time)
- func (tr *TimeRange) IntersectionDuration(tr2 TimeRange) time.Duration
- func (tr *TimeRange) Nanoseconds() uint64
- func (tr *TimeRange) Normalize()
- type TimeRanges
- type TimeSlice
- type XOXTimes
Constants ¶
const ( DT14 = "20060102150405" DT8 = "20060102" DT6 = "200601" MonthDay = "1/2" RFC3339FullDate = "2006-01-02" RFC3339Milli = "2006-01-02T15:04:05.999Z07:00" RFC3339Dash = "2006-01-02T15-04-05Z07-00" ISO8601 = "2006-01-02T15:04:05Z0700" ISO8601TZHour = "2006-01-02T15:04:05Z07" ISO8601NoTZ = "2006-01-02T15:04:05" ISO8601MilliNoTZ = "2006-01-02T15:04:05.999" ISO8601Milli = "2006-01-02T15:04:05.999Z0700" ISO8601CompactZ = "20060102T150405Z0700" ISO8601CompactNoTZ = "20060102T150405" ISO8601YM = "2006-01" Ruby = "2006-01-02 15:04:05 -0700" // Ruby Time.now.to_s SQLTimestamp = "2006-01-02 15:04:05" // MySQL, BigQuery, etc. SQLTimestampPgTz = "2006-01-02 15:04:05.999999-07" InsightlyApiQuery = "_1/_2/2006 _3:04:05 PM" DateMDY = "1/_2/2006" DateMDYSlash = "01/02/2006" DateDMYHM2 = "02:01:06 15:04" // GMT time in format dd:mm:yy hh:mm )
More predefined layouts for use in Time.Format and time.Parse.
const ( RFC3339Min = "0000-01-01T00:00:00Z" RFC3339Max = "9999-12-31T23:59:59Z" RFC3339Zero = "0001-01-01T00:00:00Z" RFC3339ZeroUnix = "1970-01-01T00:00:00Z" RFC3339YMDZeroUnix = int64(-62135596800) )
const ( YearSeconds = (365 * 24 * 60 * 60) + (6 * 60 * 60) WeekSeconds = 7 * 24 * 60 * 60 DaySeconds = 24 * 60 * 60 MonthsEN = `["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]` MillisToNanoMultiplier = 1000000 )
Variables ¶
var FormatMap = map[string]string{ "RFC3339": time.RFC3339, "RFC3339YMD": RFC3339FullDate, "ISO8601YM": ISO8601YM, }
Functions ¶
func AnyStringToQuarterTime ¶
AnyStringToQuarterTime returns the current time if in the current quarter or the end of any previous quarter.
func DaysAgoDowStrings ¶
func DaysToDowStrings ¶
func Dt14ForInts ¶
Dt8ForInts returns a Dt8 value for a UTC year, month, day, hour, minute and second.
func Dt14ForString ¶
Dt14ForString returns a Dt14 value given a layout and value to parse to time.Parse.
func Dt14ForTime ¶
Dt14ForTime returns a Dt14 value given a time.Time struct.
func Dt6ForTime ¶
Dt6ForTime returns the Dt6 value for time.Time.
func Dt6MinMaxSlice ¶
func Dt8ForInts ¶
Dt8ForInts returns a Dt8 value for year, month, and day.
func Dt8ForString ¶
Dt8ForString returns a Dt8 value given a layout and value to parse to time.Parse.
func Dt8ForTime ¶
Dt8ForTime returns a Dt8 value given a time struct.
func DurationDays ¶
func DurationDaysInt64 ¶ added in v0.0.5
func DurationForNowSubDt8 ¶
DurationForNowSubDt8 returns a duartion struct between a Dt8 value and the current time.
func DurationFromProtobuf ¶
DurationFromProtobuf converts a protobuf duration to a `time.Duration`. More on protobuf: https://godoc.org/github.com/golang/protobuf/ptypes/duration#Duration
func DurationIsZero ¶
func DurationYears ¶ added in v0.0.5
func DurationZero ¶
func EqualQuarter ¶
func FirstDayOfISOWeek ¶
FirstDayOfISOWeek returns a time.Time object for the first day of a given ISO week. https://xferion.com/golang-reverse-isoweek-get-the-date-of-the-first-day-of-iso-week/
func FirstNonZeroTimeParsed ¶
func FormatDurationInfoMinSec ¶
func FormatDurationInfoMinSec(di DurationInfo) string
FormatDurationInfoMinSec returns the duration as a simple string like 01:01.
func FormatQuarter ¶
FormatQuarter takes quarter time and formats it using "Q# YYYY".
func FormatQuarterYYQ ¶
FormatQuarterYYQ takes quarter time and formats it using "'YY Q#".
func FormatQuarterYYYYQ ¶
FormatQuarter takes quarter time and formats it using "YYYY Q#".
func FormatTimeMulti ¶
FormatTimeMulti formats a `time.Time` object or an epoch number. It is adapted from `github.com/wcharczuk/go-chart`.
func FromToFirstValue ¶
func FromToFirstValueOrEmpty ¶
func GreaterTime ¶
GreaterTime returns the greater of two times.
func InQuarterRange ¶
InQuarterRange checks to see if the date is within 2 quarters.
func InQuarterTime ¶
func InRange ¶
InRange checks to see if a time is within a provided time range with options whether the begin and end ranges are inclusive or exclusive. Exclusive ranges are the default.
func IntToBaseXString ¶
func IntervalStart ¶
func IsGreaterThan ¶
IsGreaterThan compares two times and returns true if the left time is greater than the right time.
func IsLessThan ¶
IsLessThan compares two times and returns true if the left time is less than the right time.
func IsQuarterInt32 ¶
func IsQuarterStart ¶
func IsYearStart ¶
func LesserTime ¶
LesserTime returns the lesser of two times.
func MinMaxInt32 ¶
func MonthNames ¶
func MonthNames() []string
func MonthToQuarter ¶
MonthToQuarter converts a month to a calendar quarter.
func MustInQuarterRange ¶
MustInQuarterRange returns whether a date is within 2 quarters. It panics if the quarter integer is not valid.
func MustParseDuration ¶
func NewDurationDays ¶
NewDurationDays returns `time.Duration` given a number of days
func NewDurationSeconds ¶
NewDurationSeconds returns a new `time.Duration` given a number of seconds.
func NextQuarterInt32 ¶
func NumQuartersInt32 ¶
func OffsetFormat ¶
OffsetFormat converts an integer offset value to a string value to use in string time formats. Note: RFC-3339 times use colons and the UTC "Z" offset.
func ParseDayOfWeek ¶
func ParseDuration ¶
ParseDuration adds days (d), weeks (w), years (y).
func ParseFirst ¶
ParseFirst attempts to parse a string with a set of layouts.
func ParseOrZero ¶
ParseOrZero returns a parsed time.Time or the RFC-3339 zero time.
func ParseTimeSQLTimestampUsingOffset ¶
ParseTimeSQLTimestampUsingOffset converts a SQL timestamp without timezone adding in a manual integer timezone.
func ParseTimeUsingOffset ¶
func QuarterDuration ¶
QuarterDuration returns a time.Duration representing the calendar quarter for the time provided.
func QuarterEnd ¶
QuarterEnd returns a time.Time for the end of the quarter by second in UTC time.
func QuarterInt32ForTime ¶
func QuarterInt32Now ¶
func QuarterInt32Now() int32
func QuarterInt32Timeline ¶
func QuarterInt32ToYear ¶
func QuarterProjection ¶
QuarterProjection takes a time and numeric value, estimating the value at the end of the quarter using a straight-line projection.
func QuarterStart ¶
QuarterStart returns a time.Time for the beginning of the quarter in UTC time.
func QuarterStartString ¶
func QuarterToMonth ¶
QuarterToMonth converts a calendar quarter to a month.
func QuartersInt32RelToAbs ¶
QuartersInt32RelToAbs is useful relative date queries.
func SliceMinMax ¶
SliceMinMax returns the min and max times of a time slice.
func SubDuration ¶
SubDuration subtracts one duration from another and returns the result as a `time.Duration`.
func TimeDeltaDow ¶
func TimeDeltaDowInt ¶
func TimeDeltaDowString ¶
func TimeForDt14 ¶
TimeForDt14 returns a time.Time value given a Dt14 value.
func TimeForDt6 ¶
TimeForDt6 returns a time.Time value given a Dt6 value.
func TimeForDt8 ¶
TimeForDt8 returns a time.Time value given a Dt8 value.
func TimeIsZeroAny ¶
func TimeMinRFC3339 ¶
func TimeSeriesMinMax ¶
TimeSeriesMinMax builds a time series based on supplied interval.
func TimeSeriesSlice ¶
TimeSeriesSlice builds a time series based on supplied interval.
func TimeZeroRFC3339 ¶
func TimeZeroUnix ¶
func UnixMillis ¶
TimeForEpochMillis returns the time.Time value for an epoch in milliseconds
func WeekStart ¶
WeekStart takes a time.Time object and a week start day in the time.Weekday format.
Types ¶
type DurationInfo ¶
type DurationInfo struct { Hours int64 Minutes int64 Seconds int64 Milliseconds int64 Microseconds int64 Nanoseconds int64 }
DurationInfo is a struct that holds integer values for each time unit including hours, minutes, seconds milliseconds, microseconds, and nanoseconds.
func NewDurationInfo ¶
func NewDurationInfo(dur time.Duration) DurationInfo
NewDurationInfo returns a DurationInfo struct for a duration in nanos.
func ParseDurationInfoStrings ¶
func ParseDurationInfoStrings(hr, mn, sc, ms, us, ns string) (DurationInfo, error)
ParseDurationInfoStrings returns a DurationInfo object for various time units.
func (*DurationInfo) Duration ¶
func (di *DurationInfo) Duration() time.Duration
Duration returns a `time.Duration` struct representing the duration.
func (*DurationInfo) TotalNanoseconds ¶
func (di *DurationInfo) TotalNanoseconds() int64
TotalNanoseconds returns the total number of nanoseconds represented by the duration.
type DurationPct ¶
type DurationPct struct { DurationStartTime time.Time DurationEndTime time.Time DurationActive time.Duration DurationRange time.Duration DurationPct float64 }
func (*DurationPct) Inflate ¶
func (dp *DurationPct) Inflate() error
func (*DurationPct) InflateDurationActive ¶
func (dp *DurationPct) InflateDurationActive() error
type Event ¶
type Event struct { DurationPct DurationPct ImpactPct ImpactPct EventImpactPct float64 EventUptimePct float64 }
type ISO8601NoTzMilliTime ¶
func (ISO8601NoTzMilliTime) MarshalJSON ¶
func (t ISO8601NoTzMilliTime) MarshalJSON() ([]byte, error)
func (*ISO8601NoTzMilliTime) UnmarshalJSON ¶
func (t *ISO8601NoTzMilliTime) UnmarshalJSON(buf []byte) error
type QuarterTimeline ¶
type QuarterTimeline struct {
// contains filtered or unexported fields
}
func (*QuarterTimeline) Add ¶
func (qt *QuarterTimeline) Add(yyyyq int32)
func (*QuarterTimeline) AddInit ¶
func (qt *QuarterTimeline) AddInit(yyyyq int32)
func (*QuarterTimeline) Inflate ¶
func (qt *QuarterTimeline) Inflate() error
func (*QuarterTimeline) Timeline ¶
func (qt *QuarterTimeline) Timeline() ([]int32, error)
func (*QuarterTimeline) TimelineIndex ¶
func (qt *QuarterTimeline) TimelineIndex(yyyyq int32) (int, error)
type RFC3339YMDTime ¶
func (RFC3339YMDTime) MarshalJSON ¶
func (t RFC3339YMDTime) MarshalJSON() ([]byte, error)
func (*RFC3339YMDTime) UnmarshalJSON ¶
func (t *RFC3339YMDTime) UnmarshalJSON(buf []byte) error
type TimeMeta ¶
type TimeMeta struct { This time.Time YearStart time.Time QuarterStart time.Time MonthStart time.Time WeekStart time.Time }
// WeekStart takes a time.Time object and a week start day // in the time.Weekday format.
func WeekStart(dt time.Time, dow time.Weekday) (time.Time, error) { return TimeDeltaDowInt(dt.UTC(), int(dow), -1, true, true) }
// MonthStart returns a time.Time for the beginning of the // month in UTC time.
func MonthStart(dt time.Time) time.Time { dt = dt.UTC() return time.Date(dt.Year(), dt.Month(), 1, 0, 0, 0, 0, time.UTC) }
// QuarterEnd returns a time.Time for the end of the // quarter by second in UTC time.
func QuarterEnd(dt time.Time) time.Time { qs := QuarterStart(dt.UTC()) qn := TimeDt6AddNMonths(qs, 3) return time.Date(qn.Year(), qn.Month(), 0, 23, 59, 59, 0, time.UTC) }
// YearStart returns a a time.Time for the beginning of the year // in UTC time.
func YearStart(dt time.Time) time.Time { return time.Date(dt.UTC().Year(), time.January, 1, 0, 0, 0, 0, time.UTC) }
// YearEnd returns a a time.Time for the end of the year in UTC time.
func YearEnd(dt time.Time) time.Time { return time.Date(dt.UTC().Year(), time.December, 31, 23, 59, 59, 999999999, time.UTC) }
func NextYearStart(dt time.Time) time.Time { return time.Date(dt.UTC().Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC) }
func IsYearStart(t time.Time) bool { t = t.UTC() if t.Nanosecond() == 0 && t.Second() == 0 && t.Minute() == 0 && t.Hour() == 0 && t.Day() == 1 && t.Month() == time.January { return true } return false }
func ToMonthStart(t time.Time) time.Time { return time.Date( t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location()) }
TimeMeta is a struct for holding various times related to a current time, including year start, quarter start, month start, and week start.
type TimeMore ¶
type TimeMore struct {
// contains filtered or unexported fields
}
TimeMore is a struct for holding various times related to a current time, including year start, quarter start, month start, and week start.
func (*TimeMore) MonthStart ¶
func (*TimeMore) QuarterEnd ¶
func (*TimeMore) QuarterStart ¶
type TimeRange ¶
TimeRange represents a time range with a max and min value.
func (*TimeRange) HasIntersection ¶
func (*TimeRange) IntersectionDuration ¶
func (*TimeRange) Nanoseconds ¶
type TimeRanges ¶
type TimeRanges []*TimeRange
func (TimeRanges) FilterNonZero ¶
func (trs TimeRanges) FilterNonZero() TimeRanges
func (TimeRanges) IntersectionAny ¶
func (trs TimeRanges) IntersectionAny() time.Duration