summaryrefslogtreecommitdiff
path: root/os/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/time.h')
-rw-r--r--os/time.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/os/time.h b/os/time.h
new file mode 100644
index 0000000..f4706e0
--- /dev/null
+++ b/os/time.h
@@ -0,0 +1,23 @@
+#ifndef TIME_H
+#define TIME_H
+
+#include "thread.h"
+
+class Time {
+ private:
+ static volatile uint32_t systime;
+
+ public:
+ inline static void tick() {
+ systime++;
+ }
+
+ inline static void sleep(uint32_t ms) {
+ ms += systime;
+ while(systime < ms) {
+ Thread::yield();
+ }
+ }
+};
+
+#endif