From d8a9d4a24ed5c5039a2990c0fab30fb8054b825a 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 9161373c..7cdd6623 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 65d6dbee..3067bc19 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