summaryrefslogtreecommitdiff
path: root/kernel/lib
diff options
context:
space:
mode:
authorIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-20 15:01:19 -0400
committerIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-20 15:01:19 -0400
commit1171987335034631d6e354b2d28682ad5c53dac6 (patch)
tree4e11513e3a983fabcc27763682510b9b9c177f98 /kernel/lib
parentread BARs from PCI (diff)
downloadcomus-1171987335034631d6e354b2d28682ad5c53dac6.tar.gz
comus-1171987335034631d6e354b2d28682ad5c53dac6.tar.bz2
comus-1171987335034631d6e354b2d28682ad5c53dac6.zip
add rudimentary sleeping function based on CMOS clock
Diffstat (limited to 'kernel/lib')
-rw-r--r--kernel/lib/ktime.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/lib/ktime.c b/kernel/lib/ktime.c
new file mode 100644
index 0000000..9bfcaa9
--- /dev/null
+++ b/kernel/lib/ktime.c
@@ -0,0 +1,15 @@
+#include <lib/klib.h>
+#include <comus/time.h>
+
+void kspin_sleep_seconds(size_t seconds)
+{
+ const uint64_t start = unixtime();
+
+ while (1) {
+ const uint64_t now = unixtime();
+
+ if (now - start > seconds) {
+ return;
+ }
+ }
+}