Cancel planned manual update of system time on turning ntp on

This commit is contained in:
bitcoffee 2022-01-23 21:59:28 +08:00
parent 13f5826602
commit 305a4744f3
2 changed files with 47 additions and 1 deletions

View File

@ -4,7 +4,7 @@
%endif
Name: anaconda
Version: 33.19
Release: 35
Release: 36
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -120,6 +120,7 @@ Patch6076: delete-datezone-map.patch
Patch6077: backport-fix-boot-options-generated-by-dracut-module.patch
Patch9027: bugfix-remove-flatpack-support.patch
Patch6078: bugfix-Cancel-planned-manual-update-of-system-time-on-turni.patch
%define dbusver 1.2.3
%define dnfver 3.6.0
@ -337,6 +338,12 @@ update-desktop-database &> /dev/null || :
%{_datadir}/gtk-doc
%changelog
* Sun Jan 23 2022 liuxin <liuxin350@huawei.com> - 33.19-36
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Cancel planned manual update of system time on turning ntp on
* Sat Jan 22 2022 fengtao <fengtao40@huawei.com> - 33.19-35
- Type:bugfix
- CVE:NA

View File

@ -0,0 +1,39 @@
From ab1ec03e4b6ae7cfc492d330233b63f344f5fee8 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 31 Dec 2021 19:01:08 +0800
Subject: [PATCH 1/2] init
---
pyanaconda/ui/gui/spokes/datetime_spoke.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 09deabb..8ebc5bb 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -1059,8 +1059,22 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
def _show_no_ntp_server_warning(self):
self.set_warning(_("You have no working NTP server configured"))
+ def _cancel_planned_update(self):
+ """Cancel system time update planned by manual setting"""
+ # cancel system time update
+ if self._start_updating_timer:
+ self._start_updating_timer.cancel()
+ self._start_updating_timer = None
+ # re-enable UI update because it will not be done by the
+ # system time update we've just cancelled
+ if not self._update_datetime_timer:
+ self._update_datetime_timer = Timer()
+ self._update_datetime_timer.timeout_sec(1, self._update_datetime)
+
def on_ntp_switched(self, switch, *args):
if switch.get_active():
+ self._cancel_planned_update()
+
#turned ON
if not conf.system.can_set_time_synchronization:
#cannot touch runtime system, not much to do here
--
2.27.0