1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

sd-device: use right clock when comparing initialization usec

we actually use CLOCK_MONOTONIC for the timestamp, hence when
comparing/subtracting it from the current time, also use
CLOCK_MONOTONIC.
This commit is contained in:
Lennart Poettering 2021-04-20 15:56:03 +02:00
parent a156eb89c8
commit 02ef01ade3

View File

@ -1441,10 +1441,10 @@ _public_ int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *u
if (!device->is_initialized)
return -EBUSY;
if (!device->usec_initialized)
if (device->usec_initialized == 0)
return -ENODATA;
now_ts = now(clock_boottime_or_monotonic());
now_ts = now(CLOCK_MONOTONIC);
if (now_ts < device->usec_initialized)
return -EIO;