Documentation ¶
Overview ¶
The util package contains general functions to support the other packages (timeutils, sysutils)
Index ¶
- Constants
- Variables
- func GetEndOfDayBoundaryBefore(timeValue time.Time) (latestEndOfDayBoundary time.Time)
- func GetLocalTimeInProperLocation(localTime string, internalTime time.Time) (localTimeWithLocation time.Time)
- func GetLocaltimeOffset(localTime string, internalTime time.Time) (location *time.Location)
- func GetMidnightUTCBefore(timeValue time.Time) (latestMidnightBoundary time.Time)
- func GetOrLoadLocationForName(locationName string) (location *time.Location, err error)
- func GetTimeInSeconds(timeValue string) (value int64)
- func GetTimeUTC(timeValue string) (time.Time, error)
- func GetTimeWithImpliedLocation(localTime string, location *time.Location) (time.Time, error)
- func ParseGoogleDriveDate(value string) (timeValue time.Time, err error)
- func Propagate(err error)
- func TimeInUTCNoTz(timevalue time.Time) (localTime string)
Constants ¶
const ( // Default time format TIMEFORMAT = "2006-01-02 15:04:05 MST" // Default time format TIMEFORMAT_NO_TZ = "2006-01-02 15:04:05" // Time format used by the Google Drive api DRIVE_TIMEFORMAT = "2006-01-02T15:04:05.000Z" // Timezone for Dexcom interval time values INTERNAL_TIMEZONE = "GMT" // Let's make days end at 18h00 HOUR_OF_END_OF_DAY = 18 )
Variables ¶
var GLUKIT_EPOCH_TIME = time.Unix(1072915200, 0)
Beginning of time should be unix epoch 0 but, to optimize some processing may iterate overtime starting at this value, we just define the notion of Glukit epoch time and have this value be set to something less far back but still before anything interesting happened in the Glukit world. This maps to 01 Jan 2004 00:00:00 GMT.
Functions ¶
func GetEndOfDayBoundaryBefore ¶
GetEndOfDayBoundaryBefore returns the boundary of very last "end of day" before the given time. To give an example, if the given time is July 17th 8h00 PST, the boundary returned is going to be July 17th 06h00. If the time is July 17th 05h00 PST, the boundary returned is July 16th 06h00. Very important: The timeValue's location must be accurate!
func GetLocalTimeInProperLocation ¶
func GetLocalTimeInProperLocation(localTime string, internalTime time.Time) (localTimeWithLocation time.Time)
GetLocalTimeInProperLocation returns the parsed local time with the location appropriately set as extrapolated by calculating the difference of the internal time vs the local time
func GetLocaltimeOffset ¶
GetLocaltimeOffset returns the Fixed location extrapolated by calculating the offset of the localtime and the internal time in UTC
func GetMidnightUTCBefore ¶
GetMidnightUTCBefore returns the boundary of very last occurence of midnight before the given time. To give an example, if the given time is July 17th 2h00 UTC, the boundary returned is going to be July 17th 00h00. If the time is July 16th 23h00 PST, the boundary returned is July 16th 00h00.
func GetTimeInSeconds ¶
GetTimeInSeconds parses a datetime string and returns its unix timestamp.
func GetTimeUTC ¶
GetTimeInSeconds parses a datetime string and returns its unix timestamp.
func ParseGoogleDriveDate ¶
ParseGoogleDriveDate parses a Google Drive API time value
func Propagate ¶
func Propagate(err error)
Propagate aborts the current execution if err is non-nil.
func TimeInUTCNoTz ¶
Returns the timevalue with its timezone set to UTC but without printing the timezone in the formatted string
Types ¶
This section is empty.