From fc53809803cd2bc2434e312b19a18fa36776da12 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:40 +0200 Subject: Adding upstream version 256. Signed-off-by: Daniel Baumann --- src/shared/clock-util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/shared/clock-util.c') diff --git a/src/shared/clock-util.c b/src/shared/clock-util.c index b0cbe30..37d0232 100644 --- a/src/shared/clock-util.c +++ b/src/shared/clock-util.c @@ -27,10 +27,11 @@ int clock_get_hwclock(struct tm *tm) { if (fd < 0) return -errno; - /* This leaves the timezone fields of struct tm - * uninitialized! */ + /* This leaves the timezone fields of struct tm uninitialized! */ if (ioctl(fd, RTC_RD_TIME, tm) < 0) - return -errno; + /* Some drivers return -EINVAL in case the time could not be kept, i.e. power loss + * happened. Let's turn that into a clearly recognizable error */ + return errno == EINVAL ? -ENODATA : -errno; /* We don't know daylight saving, so we reset this in order not * to confuse mktime(). */ -- cgit v1.2.3