summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyotaek Shim <hyotaek.shim@samsung.com>2018-06-27 19:47:30 +0900
committerHyotaek Shim <hyotaek.shim@samsung.com>2018-06-28 00:25:50 +0000
commit3862254fbb98c8f7e04d4b93fecf1a497b6aabd9 (patch)
tree82815c171da9b79ce0c30a6fa4006a2eb97dc199
parentb8c2be63386b6200027faf61acb1791e663884c0 (diff)
downloadsystemd-3862254fbb98c8f7e04d4b93fecf1a497b6aabd9.tar.gz
systemd-3862254fbb98c8f7e04d4b93fecf1a497b6aabd9.tar.bz2
systemd-3862254fbb98c8f7e04d4b93fecf1a497b6aabd9.zip
Revert "resolved: apply epoch to system time from PID 1"submit/tizen/20180704.010647accepted/tizen/unified/20180704.154010
This reverts commit 021dd87bc055a5bfb2dcef83fc868fe24648b959. In Tizen Watch products, users can set the RTC as they want, even to the past. Here, it has been observed that the system clock is reset every booting. For instance, 1) After a boot, Kernel RTC is 2018-01-02. 2) Since the system clock initialized by RTC is 2018-01-02 is less than 2018-06-27 (TIME_EPOCH_USEC), Systemd resets the system clock as TIME_EPOCH_USEC, but does not modify RTC. Although the system clock shown to users is not an intended value, the time goes by to 2018-06-28. 3) After another reboot, the system clock is restored to 2018-06-27 (TIME_EPOCH_USEC) because RTC is still less than TIME_EPOCH_USEC. Change-Id: Ib2c61e9b1fd9d4b0d33f99868dda1daaec21878d Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
-rw-r--r--src/basic/clock-util.c14
-rw-r--r--src/basic/clock-util.h1
-rw-r--r--src/core/main.c8
3 files changed, 1 insertions, 22 deletions
diff --git a/src/basic/clock-util.c b/src/basic/clock-util.c
index 7fe8d35ea5..3b617c06cd 100644
--- a/src/basic/clock-util.c
+++ b/src/basic/clock-util.c
@@ -149,17 +149,3 @@ int clock_reset_timewarp(void) {
return 0;
}
-
-#define TIME_EPOCH_USEC ((usec_t) TIME_EPOCH * USEC_PER_SEC)
-
-int clock_apply_epoch(void) {
- struct timespec ts;
-
- if (now(CLOCK_REALTIME) >= TIME_EPOCH_USEC)
- return 0;
-
- if (clock_settime(CLOCK_REALTIME, timespec_store(&ts, TIME_EPOCH_USEC)) < 0)
- return -errno;
-
- return 1;
-}
diff --git a/src/basic/clock-util.h b/src/basic/clock-util.h
index 8830cd2f38..facf9334fe 100644
--- a/src/basic/clock-util.h
+++ b/src/basic/clock-util.h
@@ -26,4 +26,3 @@ int clock_set_timezone(int *min);
int clock_reset_timewarp(void);
int clock_get_hwclock(struct tm *tm);
int clock_set_hwclock(const struct tm *tm);
-int clock_apply_epoch(void);
diff --git a/src/core/main.c b/src/core/main.c
index f2adca7d2b..9c9d073863 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1461,14 +1461,8 @@ int main(int argc, char *argv[]) {
* saving time change. All kernel local time concepts will be treated
* as UTC that way.
*/
- (void) clock_reset_timewarp();
+ clock_reset_timewarp();
}
-
- r = clock_apply_epoch();
- if (r < 0)
- log_error_errno(r, "Current system time is before build time, but cannot correct: %m");
- else if (r > 0)
- log_info("System time before build time, advancing clock.");
}
/* Set the default for later on, but don't actually