Kerne: SystemTimer can now output the current real time

This commit is contained in:
Bananymous 2023-08-04 15:51:03 +03:00
parent bc0e1fa898
commit d8a9d4a24e
2 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,7 @@ namespace Kernel
void sleep(uint64_t) const; void sleep(uint64_t) const;
uint64_t get_unix_timestamp() const; uint64_t get_unix_timestamp() const;
timespec get_real_time() const;
private: private:
SystemTimer() = default; SystemTimer() = default;

View File

@ -79,4 +79,11 @@ namespace Kernel
return m_boot_time + ms_since_boot() / 1000; 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;
}
} }