summaryrefslogtreecommitdiff
path: root/src/timesync
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-03-18 14:19:20 +0100
committerLennart Poettering <lennart@poettering.net>2022-03-18 17:13:36 +0100
commit52bb308c138dd1006078370c93e0e77dfc61de73 (patch)
treee7f604afa7a057a78fb65f383fa5e723f9ab614d /src/timesync
parentde0988f9d2b23580d31e857991337927a5735fe1 (diff)
downloadsystemd-52bb308c138dd1006078370c93e0e77dfc61de73.tar.gz
time-util: add macros around timespec_store() that operates on compund literal allocated timespec struct
This way we can convert usec_t to timespec on-the-fly, without a buffer. No actual behaviour change just some shortening of code.
Diffstat (limited to 'src/timesync')
-rw-r--r--src/timesync/timesyncd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index 6f316746f5..471a63689e 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -72,13 +72,12 @@ static int load_clock_timestamp(uid_t uid, gid_t gid) {
settime:
ct = now(CLOCK_REALTIME);
if (ct < min) {
- struct timespec ts;
char date[FORMAT_TIMESTAMP_MAX];
log_info("System clock time unset or jumped backwards, restoring from recorded timestamp: %s",
format_timestamp(date, sizeof(date), min));
- if (clock_settime(CLOCK_REALTIME, timespec_store(&ts, min)) < 0)
+ if (clock_settime(CLOCK_REALTIME, TIMESPEC_STORE(min)) < 0)
log_error_errno(errno, "Failed to restore system clock, ignoring: %m");
}