mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
pkg/machinie: use TZ env for reading local timezone
The TZ var can be commonly used to overwrite the timezone so we should honour that one as well. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -147,9 +147,13 @@ func (ign *DynamicIgnition) GenerateIgnitionConfig() error {
|
||||
// local means the same as the host
|
||||
// look up where it is pointing to on the host
|
||||
if ign.TimeZone == "local" {
|
||||
tz, err = getLocalTimeZone()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting local timezone: %q", err)
|
||||
if env, ok := os.LookupEnv("TZ"); ok {
|
||||
tz = env
|
||||
} else {
|
||||
tz, err = getLocalTimeZone()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting local timezone: %q", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
// getLocalTimeZone() can return empty string, do not add broken symlink in that case
|
||||
|
Reference in New Issue
Block a user