MCPcopy Create free account
hub / github.com/dolthub/doltgresql / FixedZone

Method FixedZone

postgres/parser/pgdate/zone_cache.go:82–104  ·  view source on GitHub ↗

FixedZone wraps time.FixedZone.

(hours, minutes, seconds int)

Source from the content-addressed store, hash-verified

80
81// FixedZone wraps time.FixedZone.
82func (z *zoneCache) FixedZone(hours, minutes, seconds int) *time.Location {
83 offset := (hours*60+minutes)*60 + seconds
84 z.mu.Lock()
85 ret, ok := z.mu.fixed[offset]
86 z.mu.Unlock()
87
88 if !ok {
89 if minutes < 0 {
90 minutes *= -1
91 }
92 if seconds < 0 {
93 seconds *= -1
94 }
95 // Need a field width of 3 for the leading digit because we're
96 // forcing the sign to be printed and it counts as part of the field.
97 ret = time.FixedZone(fmt.Sprintf("%+03d%02d%02d", hours, minutes, seconds), offset)
98 z.mu.Lock()
99 z.mu.fixed[offset] = ret
100 z.mu.Unlock()
101 }
102
103 return ret
104}

Callers 7

MakeTimeMethod · 0.80
MakeLocationMethod · 0.80
TestParseTimestampFunction · 0.80
convertTzToOffsetSecsFunction · 0.80
date_trunc.goFile · 0.80

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by 1

TestParseTimestampFunction · 0.64