代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From fbd28b3b40701f1fda29707dfa09d1e481c4162c Mon Sep 17 00:00:00 2001
From: hexiaowen<hexiaowen@huawei.com>
Date: Tue, 9 Jul 2019 19:13:43 +0800
Subject: [PATCH] delete clock_apply_epoch
resolved: apply epoch to system time from PID 1
For use in timesyncd we already defined a compile-time "epoch" value, which is based on the mtime of the NEWS file, and
specifies a point in time we know lies in the past at runtime. timesyncd uses this to filter out nonsensical timestamp
file data, and bump the system clock to a time that is after the build time of systemd. This patch adds similar bumping
code to earliest PID 1 initialization, so that the system never continues operation with a clock that is in the 1970ies
or even 1930s. we think it is ok when current system time is before build time.
And, don't restore time when systemd-timesyncd started.
---
src/core/main.c | 12 ------------
src/timesync/timesyncd.c | 8 --------
2 files changed, 20 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index 4051a91..c6d16b2 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1627,18 +1627,6 @@ static void initialize_clock(void) {
*/
(void) clock_reset_timewarp();
- ClockChangeDirection change_dir;
- r = clock_apply_epoch(&change_dir);
- if (r > 0 && change_dir == CLOCK_CHANGE_FORWARD)
- log_info("System time before build time, advancing clock.");
- else if (r > 0 && change_dir == CLOCK_CHANGE_BACKWARD)
- log_info("System time is further ahead than %s after build time, resetting clock to build time.",
- FORMAT_TIMESPAN(CLOCK_VALID_RANGE_USEC_MAX, USEC_PER_DAY));
- else if (r < 0 && change_dir == CLOCK_CHANGE_FORWARD)
- log_error_errno(r, "Current system time is before build time, but cannot correct: %m");
- else if (r < 0 && change_dir == CLOCK_CHANGE_BACKWARD)
- log_error_errno(r, "Current system time is further ahead %s after build time, but cannot correct: %m",
- FORMAT_TIMESPAN(CLOCK_VALID_RANGE_USEC_MAX, USEC_PER_DAY));
}
static void apply_clock_update(void) {
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index e60742c..efe56fd 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -121,14 +121,6 @@ static int load_clock_timestamp(uid_t uid, gid_t gid) {
if (ct > min)
return 0;
- /* Not that it matters much, but we actually restore the clock to n+1 here rather than n, simply
- * because we read n as time previously already and we want to progress here, i.e. not report the
- * same time again. */
- if (clock_settime(CLOCK_REALTIME, TIMESPEC_STORE(min+1)) < 0) {
- log_warning_errno(errno, "Failed to restore system clock, ignoring: %m");
- return 0;
- }
-
log_struct(LOG_INFO,
"MESSAGE_ID=" SD_MESSAGE_TIME_BUMP_STR,
"REALTIME_USEC=" USEC_FMT, min+1,
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。