[pve-devel] [PATCH pmg-api v2 3/4] Fix #7175: replace timezone handling with systemd timedatectl

Stefan Mayr stefan at mayr-stefan.de
Sun Jan 25 22:01:50 CET 2026


Usage of /etc/timezone is deprecated. The tzdata maintainers recommend
switching to timedatectl.

This changes the use of INotify to the Systemd module for timezone
settings.

Suggested-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Suggested-by: Maximiliano Sandroval <m.sandoval at proxmox.com>
Signed-off-by: Stefan Mayr <stefan at mayr-stefan.de>
---
 src/PMG/API2/Nodes.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PMG/API2/Nodes.pm b/src/PMG/API2/Nodes.pm
index 3479d64..66c4c3b 100644
--- a/src/PMG/API2/Nodes.pm
+++ b/src/PMG/API2/Nodes.pm
@@ -662,7 +662,7 @@ __PACKAGE__->register_method({
         my $ctime = time();
         my $ltime = timegm_nocheck(localtime($ctime));
         my $res = {
-            timezone => PVE::INotify::read_file('timezone'),
+            timezone => PVE::Systemd::get_timezone(),
             time => time(),
             localtime => $ltime,
         };
@@ -693,7 +693,7 @@ __PACKAGE__->register_method({
     code => sub {
         my ($param) = @_;
 
-        PVE::INotify::write_file('timezone', $param->{timezone});
+        PVE::Systemd::set_timezone($param->{timezone});
 
         return undef;
     },
-- 
2.34.1




More information about the pve-devel mailing list