From 3df97c36e645897d9d949bd37ee773aaec21a879 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 4 Aug 2023 15:51:03 +0300 Subject: [PATCH] Kerne: SystemTimer can now output the current real time --- kernel/include/kernel/Timer/Timer.h | 1 + kernel/kernel/Timer/Timer.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/kernel/include/kernel/Timer/Timer.h b/kernel/include/kernel/Timer/Timer.h index 9161373ca1..7cdd662388 100644 --- a/kernel/include/kernel/Timer/Timer.h +++ b/kernel/include/kernel/Timer/Timer.h @@ -28,6 +28,7 @@ namespace Kernel void sleep(uint64_t) const; uint64_t get_unix_timestamp() const; + timespec get_real_time() const; private: SystemTimer() = default; diff --git a/kernel/kernel/Timer/Timer.cpp b/kernel/kernel/Timer/Timer.cpp index 65d6dbeee6..3067bc19e0 100644 --- a/kernel/kernel/Timer/Timer.cpp +++ b/kernel/kernel/Timer/Timer.cpp @@ -79,4 +79,11 @@ namespace Kernel return m_boot_time + ms_since_boot() / 1000; } + timespec SystemTimer::get_real_time() const + { + auto result = time_since_boot(); + result.tv_sec += m_boot_time; + return result; + } + } \ No newline at end of file