Documentation ¶
Index ¶
- Constants
- func NormalizeUnixTime(time string) string
- func ParseLogTime(logtime string, utcepoch time.Time, dstlocations DSTLocation) (time.Time, error)
- func ParseTZ(tz string) (*time.Location, error)
- func ParseTimeWithZone(stime string) (time.Time, error)
- func SafeParseTimeWithZone(stime string) time.Time
- func SafeParseUTCEpoch(stime string) time.Time
- func SplitDstQualifier(logtime string) (string, bool)
- type DSTLocation
Constants ¶
const ( LayoutTimeWithZone = "20060102150405Z0700" LayoutUTCTime = "20060102150405" LayoutUTCEpoch = "200601021504Z0700" LayoutDBTime = "2006-01-02 15:04:05" LayoutLogTime = LayoutUTCTime )
Crawl time layouts
Variables ¶
This section is empty.
Functions ¶
func NormalizeUnixTime ¶
NormalizeUnixTime formats a Unix time with DST qualifier into a standard time formatted as 20060102150405[DS]
func ParseLogTime ¶
ParseLogTime parses a Crawl log time to a UTC time. If a UTC epoch is provided that is after the given log time, then the time is parsed in the server's local time zone as specified by dstlocations.
func ParseTZ ¶
ParseTZ parses a time zone string of the form "-0700" or "-07:00" into a time.Location. "Z" is recognized as UTC.
func ParseTimeWithZone ¶
ParseTimeWithZone parses a Crawl format time with a timezone into a time object. If the timezone is unspecified, assumes UTC.
func SafeParseTimeWithZone ¶
SafeParseTimeWithZone behaves like ParseTimeWithZone, but returns a zero time instead of an error if the parse fails.
func SafeParseUTCEpoch ¶
SafeParseUTCEpoch parses a Crawl UTC epoch formatted as 200601021504Z0700 into a UTC time.
func SplitDstQualifier ¶
SplitDstQualifier splits a Crawl log time string into a time string and a DST qualifier that is true for Daylight Savings Time and false otherwise.
Types ¶
type DSTLocation ¶
type DSTLocation struct {
// contains filtered or unexported fields
}
DSTLocation represents the non-UTC standard and DST time locations for a place
func ParseDSTLocation ¶
func ParseDSTLocation(loc string, dst string) (DSTLocation, error)
ParseDSTLocation parses the standard and DST timezones for a place given the timezone strings
func (DSTLocation) IsZero ¶
func (d DSTLocation) IsZero() bool
IsZero returns true for an uninitialized d
func (DSTLocation) Location ¶
func (d DSTLocation) Location(dst bool) *time.Location
Location gets the time location, DST or normal.
func (DSTLocation) String ¶
func (d DSTLocation) String() string