MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / LoadLocation

Method LoadLocation

pkg/util/timeutil/pgdate/zone_cache.go:51–65  ·  view source on GitHub ↗

LoadLocation wraps time.LoadLocation which does not perform caching internally and which requires many disk accesses to locate the named zoneinfo file.

(zone string)

Source from the content-addressed store, hash-verified

49// caching internally and which requires many disk accesses to
50// locate the named zoneinfo file.
51func (z *zoneCache) LoadLocation(zone string) (*time.Location, error) {
52 z.mu.Lock()
53 entry, ok := z.mu.named[zone]
54 z.mu.Unlock()
55
56 if !ok {
57 loc, err := time.LoadLocation(zone)
58
59 entry = &zoneCacheEntry{loc: loc, err: err}
60 z.mu.Lock()
61 z.mu.named[zone] = entry
62 z.mu.Unlock()
63 }
64 return entry.loc, entry.err
65}
66
67// FixedZone wraps time.FixedZone.
68func (z *zoneCache) FixedZone(hours, minutes, seconds int) *time.Location {

Callers 2

LoadLocationFunction · 0.80
ExtractMethod · 0.80

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected