]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: watchdog_get_last_ping_as_dual_timestamp()
authorIvan Kruglov <mail@ikruglov.com>
Fri, 7 Mar 2025 09:04:14 +0000 (01:04 -0800)
committerIvan Kruglov <mail@ikruglov.com>
Tue, 13 May 2025 08:55:15 +0000 (01:55 -0700)
src/shared/watchdog.c
src/shared/watchdog.h

index f00ff25ab20a7f6ad40dc82782a6302145d99a2d..28cae1c260874f7cf80aa0e1d19e9e5460a455d5 100644 (file)
@@ -206,6 +206,15 @@ usec_t watchdog_get_last_ping(clockid_t clock) {
         return map_clock_usec(watchdog_last_good_ping, CLOCK_BOOTTIME, clock);
 }
 
+dual_timestamp* watchdog_get_last_ping_as_dual_timestamp(dual_timestamp *ret) {
+        assert(ret);
+
+        ret->monotonic = watchdog_get_last_ping(CLOCK_MONOTONIC);
+        ret->realtime = watchdog_get_last_ping(CLOCK_REALTIME);
+
+        return ret;
+}
+
 static int watchdog_ping_now(void) {
         int r;
 
index c0fcccbd0735bebee4a8c5b496f26e4e9b292585..7880b041282e35a2e32f8dc74614f79b925b5f94 100644 (file)
@@ -7,6 +7,7 @@
 
 const char* watchdog_get_device(void);
 usec_t watchdog_get_last_ping(clockid_t clock);
+dual_timestamp* watchdog_get_last_ping_as_dual_timestamp(dual_timestamp *ret);
 
 int watchdog_set_device(const char *path);
 int watchdog_setup(usec_t timeout);