diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 22:18:47 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 22:18:47 -0600 |
commit | 6ab74d74ee6dc1663b66d0a9a0471f63ade5659a (patch) | |
tree | b579303cc5df38191ee9e8ad63793fbe4c867c02 /libhw/host_util.h | |
parent | 9f2e2e96321f14da97adda618a7e4721cbb9791c (diff) | |
parent | 865bb702f828784a0225b5eae9ed8803094140d5 (diff) |
Merge branch 'lukeshu/9p-read-iovec'
Diffstat (limited to 'libhw/host_util.h')
-rw-r--r-- | libhw/host_util.h | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/libhw/host_util.h b/libhw/host_util.h deleted file mode 100644 index f3ef6b4..0000000 --- a/libhw/host_util.h +++ /dev/null @@ -1,47 +0,0 @@ -/* libhw/host_util.h - Utilities for GNU/Linux hosts - * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _LIBHW_HOST_UTIL_H_ -#define _LIBHW_HOST_UTIL_H_ - -#include <time.h> /* for struct timespec */ -#include <sys/time.h> /* for struct timeval */ - -#include <libhw/generic/alarmclock.h> /* for {X}S_PER_S */ - -int host_sigrt_alloc(void); - -typedef struct timeval host_us_time_t; -typedef struct timespec host_ns_time_t; - -static inline host_us_time_t ns_to_host_us_time(uint64_t time_ns) { - host_us_time_t ret; - ret.tv_sec = time_ns - /NS_PER_S; - ret.tv_usec = (time_ns - ((uint64_t)ret.tv_sec)*NS_PER_S) - /(NS_PER_S/US_PER_S); - return ret; -} - -static inline host_ns_time_t ns_to_host_ns_time(uint64_t time_ns) { - host_ns_time_t ret; - ret.tv_sec = time_ns - /NS_PER_S; - ret.tv_nsec = time_ns - ((uint64_t)ret.tv_sec)*NS_PER_S; - return ret; -} - -static inline uint64_t ns_from_host_us_time(host_us_time_t host_time) { - return (((uint64_t)host_time.tv_sec) * NS_PER_S) + - ((uint64_t)host_time.tv_usec * (NS_PER_S/US_PER_S)); -} - -static inline uint64_t ns_from_host_ns_time(host_ns_time_t host_time) { - return (((uint64_t)host_time.tv_sec) * NS_PER_S) + - ((uint64_t)host_time.tv_nsec); -} - -#endif /* _LIBHW_HOST_UTIL_H_ */ |