aboutsummaryrefslogtreecommitdiff
path: root/pkg/machine/ignition_linux.go
blob: 6db5a8e7a9b5f351879a21179f727dca942f7dbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package machine

import (
	"os/exec"
	"strings"
)

func getLocalTimeZone() (string, error) {
	output, err := exec.Command("timedatectl", "show", "--property=Timezone").Output()
	if err != nil {
		return "", err
	}
	// Remove prepended field and the newline
	return strings.TrimPrefix(strings.TrimSuffix(string(output), "\n"), "Timezone="), nil
}