Documentation ¶
Index ¶
- func ArbitraryDatestring2MidnightPdt(s string, fmt string) time.Time
- func AtLocalMidnight(in time.Time) time.Time
- func DateRangeToPacificTimeWindows(sStr, eStr string) [][]time.Time
- func Datestring2MidnightPdt(s string) time.Time
- func InPdt(t time.Time) time.Time
- func IntermediateMidnights(s, e time.Time) (ret []time.Time)
- func MonthWindowForTime(t time.Time) (start time.Time, end time.Time)
- func NowInPdt() time.Time
- func ParseInPdt(format string, value string) (time.Time, error)
- func RoundDuration(d time.Duration) time.Duration
- func Time2Datestring(t time.Time) string
- func Timeslots(s, e time.Time, d time.Duration) []time.Time
- func TruncateToLocalDay(in time.Time) time.Time
- func TruncateToUTCDay(in time.Time) time.Time
- func WindowForTime(t time.Time) (start time.Time, end time.Time)
- func WindowForToday() (start time.Time, end time.Time)
- func WindowForYesterday() (start time.Time, end time.Time)
- func WindowsForRange(s, e time.Time) [][]time.Time
- type TimeOfDayRange
- func (tr TimeOfDayRange) AnchorInsideDay(t time.Time) (time.Time, time.Time)
- func (tr TimeOfDayRange) Contains(t time.Time) bool
- func (tr TimeOfDayRange) End() time.Time
- func (tr TimeOfDayRange) IsInitialized() bool
- func (tr TimeOfDayRange) Overlaps(s, e time.Time) bool
- func (tr TimeOfDayRange) Start() time.Time
- func (tr TimeOfDayRange) String() string
- func (tr TimeOfDayRange) Values() url.Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Datestring2MidnightPdt ¶
func InPdt ¶
All these FooPdt functions should be renamed FooPacificTime; they're not specific to dayight savings. And in fact should be turned into LocalTime or something.
func IntermediateMidnights ¶
Return all midnights inbetween s & e - not including s or e if they happen to be midnight. Caller should ensure s and e are in the same timezone.
func MonthWindowForTime ¶
Get the window for all in the seconds in the month which contains the time
func Time2Datestring ¶
func Timeslots ¶
Returns a list of time buckets, of given duration, that the inputs span. Each bucket is returned as the time-instant that begins the bucket.
func TruncateToLocalDay ¶
Round off to 00:00:00 today (i.e. most recent midnight) Can't use time.Round(24*time.Hour); it operates in UTC, so rounds into weird boundaries
func TruncateToUTCDay ¶
Perhaps time.Round(24*time.Hour) works here ?
func WindowForTime ¶
A 'window' is a pair of times spanning 23-25h, respecting the timezone of the input, and honoring daylight savings changes. start will be midnight (00:00:00) that day; end is 24h later, i.e. 00:00:00 the next day
Types ¶
type TimeOfDayRange ¶
TimeOfDayRange specifies a duration within a day
func FormValueTimeOfDayRange ¶
func FormValueTimeOfDayRange(r *http.Request, stem string) (TimeOfDayRange, error)
If fields absent or blank, returns {0.0, 0.0}
func ParseTimeOfDay ¶
func ParseTimeOfDay(start string, length string) (TimeOfDayRange, error)
func (TimeOfDayRange) AnchorInsideDay ¶
Given an 'anchor day' t, find the start/end times of the TimeOfDay inside it. If the range straddles midnight, then 'end' will come before 'start', and will be the end of the previous day's range. Note that 't' *must* have a location defined, or this will panic().
func (TimeOfDayRange) End ¶
func (tr TimeOfDayRange) End() time.Time
func (TimeOfDayRange) IsInitialized ¶
func (tr TimeOfDayRange) IsInitialized() bool
func (TimeOfDayRange) Start ¶
func (tr TimeOfDayRange) Start() time.Time
func (TimeOfDayRange) String ¶
func (tr TimeOfDayRange) String() string
func (TimeOfDayRange) Values ¶
func (tr TimeOfDayRange) Values() url.Values