MCPcopy Index your code
hub / github.com/ddev/ddev / GetLocalTimezone

Function GetLocalTimezone

pkg/util/utils.go:481–494  ·  view source on GitHub ↗

GetLocalTimezone tries to find local timezone from $TZ or /etc/localtime symlink

()

Source from the content-addressed store, hash-verified

479
480// GetLocalTimezone tries to find local timezone from $TZ or /etc/localtime symlink
481func GetLocalTimezone() (string, error) {
482 timezone := ""
483 if os.Getenv("TZ") != "" {
484 timezone = os.Getenv("TZ")
485 } else {
486 localtimeFile := filepath.Join("/etc", "localtime")
487 var err error
488 timezone, err = filepath.EvalSymlinks(localtimeFile)
489 if err != nil {
490 return "", fmt.Errorf("unable to read timezone from %s file: %v", localtimeFile, err)
491 }
492 }
493 return GetTimezone(timezone)
494}
495
496// SubtractSlices removes elements of slice b from slice a.
497func SubtractSlices(a, b []string) []string {

Callers 4

TestTimezoneConfigFunction · 0.92
generateRouterComposeFunction · 0.92
RenderComposeYAMLMethod · 0.92

Calls 2

GetTimezoneFunction · 0.85
ErrorfMethod · 0.80

Tested by 1

TestTimezoneConfigFunction · 0.74