summaryrefslogtreecommitdiff
path: root/libhw/host_alarmclock.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhw/host_alarmclock.c')
-rw-r--r--libhw/host_alarmclock.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/libhw/host_alarmclock.c b/libhw/host_alarmclock.c
index 5f7e494..bb1821a 100644
--- a/libhw/host_alarmclock.c
+++ b/libhw/host_alarmclock.c
@@ -1,13 +1,12 @@
/* libhw/host_alarmclock.c - <libhw/generic/alarmclock.h> implementation for POSIX hosts
*
- * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <errno.h>
#include <error.h>
#include <signal.h>
-#include <time.h>
#include <libcr/coroutine.h>
#include <libmisc/assert.h>
@@ -16,17 +15,10 @@
#define IMPLEMENTATION_FOR_LIBHW_GENERIC_ALARMCLOCK_H YES
#include <libhw/generic/alarmclock.h>
-#include "host_util.h" /* for host_sigrt_alloc(), ns_to_host_ns_time() */
-
-/* Types **********************************************************************/
+#define IMPLEMENTATION_FOR_LIBHW_HOST_ALARMCLOCK_H YES
+#include <libhw/host_alarmclock.h>
-struct hostclock {
- implements_alarmclock;
- bool initialized;
- clockid_t clock_id;
- timer_t timer_id;
- struct alarmclock_trigger *queue;
-};
+#include "host_util.h" /* for host_sigrt_alloc(), ns_to_host_ns_time() */
/* Globals ********************************************************************/
@@ -39,19 +31,12 @@ static bool hostclock_add_trigger(implements_alarmclock *self,
static void hostclock_del_trigger(implements_alarmclock *self,
struct alarmclock_trigger *trigger);
-static struct alarmclock_vtable hostclock_vtable = {
+struct alarmclock_vtable hostclock_vtable = {
.get_time_ns = hostclock_get_time_ns,
.add_trigger = hostclock_add_trigger,
.del_trigger = hostclock_del_trigger,
};
-static struct hostclock clock_monotonic = {
- .vtable = &hostclock_vtable,
- .clock_id = CLOCK_MONOTONIC,
-};
-
-implements_alarmclock *bootclock = &clock_monotonic;
-
/* Main implementation ********************************************************/
static uint64_t hostclock_get_time_ns(implements_alarmclock *_alarmclock) {