github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/machine/ignition_linux.go (about)

     1  package machine
     2  
     3  import (
     4  	"os/exec"
     5  	"strings"
     6  )
     7  
     8  func getLocalTimeZone() (string, error) {
     9  	output, err := exec.Command("timedatectl", "show", "--property=Timezone").Output()
    10  	if err != nil {
    11  		return "", err
    12  	}
    13  	// Remove prepended field and the newline
    14  	return strings.TrimPrefix(strings.TrimSuffix(string(output), "\n"), "Timezone="), nil
    15  }