summaryrefslogtreecommitdiff
path: root/pkg/machine/ignition_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/machine/ignition_linux.go')
-rw-r--r--pkg/machine/ignition_linux.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/machine/ignition_linux.go b/pkg/machine/ignition_linux.go
new file mode 100644
index 000000000..6db5a8e7a
--- /dev/null
+++ b/pkg/machine/ignition_linux.go
@@ -0,0 +1,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
+}