Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37508754
en ru br
Репозитории ALT

Группа :: Система/Серверы
Пакет: pve-manager

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: pve-manager-timezone.patch
Скачать


--- pve-manager/PVE/API2/Nodes.pm.timezone	2019-08-28 10:27:51.000000000 +0300
+++ pve-manager/PVE/API2/Nodes.pm	2019-09-10 14:34:47.312691683 +0300
@@ -1258,6 +1258,23 @@
 	return undef;
     }});
 
+my $get_timezone = {};
+
+sub get_timezone {
+    my ($timezone) = '';
+
+    my $code = sub {
+        my $line = shift;
+        if ($line =~ m/^Timezone\=(\S+)/) {
+            $timezone = $1;
+        }
+    };
+
+    PVE::Tools::run_command(['/usr/bin/timedatectl', 'show'], outfunc => $code);
+
+    return $timezone;
+}
+
 __PACKAGE__->register_method({
     name => 'time',
     path => 'time',
@@ -1301,7 +1319,7 @@
 	my $ctime = time();
 	my $ltime = timegm_nocheck(localtime($ctime));
 	my $res = {
-	    timezone => PVE::INotify::read_file('timezone'),
+	    timezone => get_timezone(),
 	    time => $ctime,
 	    localtime => $ltime,
 	};
@@ -1333,7 +1351,8 @@
     code => sub {
 	my ($param) = @_;
 
-	PVE::INotify::write_file('timezone', $param->{timezone});
+	my $cmd = ['/usr/bin/timedatectl', 'set-timezone', $param->{timezone}];
+	PVE::Tools::run_command($cmd);
 
 	return undef;
     }});
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin