summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kernel/Time/TimeManagement.cpp7
-rw-r--r--Kernel/Time/TimeManagement.h2
-rw-r--r--Kernel/init.cpp23
3 files changed, 7 insertions, 25 deletions
diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp
index ea221da415..3ac0e06494 100644
--- a/Kernel/Time/TimeManagement.cpp
+++ b/Kernel/Time/TimeManagement.cpp
@@ -62,10 +62,13 @@ time_t TimeManagement::epoch_time() const
return m_epoch_time;
}
-void TimeManagement::initialize(bool probe_non_legacy_hardware_timers)
+void TimeManagement::initialize()
{
ASSERT(!TimeManagement::initialized());
- s_time_management = new TimeManagement(probe_non_legacy_hardware_timers);
+ if (kernel_command_line().lookup("time").value_or("modern") == "legacy")
+ s_time_management = new TimeManagement(false);
+ else
+ s_time_management = new TimeManagement(true);
}
time_t TimeManagement::seconds_since_boot() const
{
diff --git a/Kernel/Time/TimeManagement.h b/Kernel/Time/TimeManagement.h
index eba89a491b..00fc027738 100644
--- a/Kernel/Time/TimeManagement.h
+++ b/Kernel/Time/TimeManagement.h
@@ -41,7 +41,7 @@ class HardwareTimer;
class TimeManagement {
public:
static bool initialized();
- static void initialize(bool probe_non_legacy_hardware_timers);
+ static void initialize();
static TimeManagement& the();
time_t epoch_time() const;
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index a2dabe0b04..53cabdaf86 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -85,7 +85,6 @@ namespace Kernel {
[[noreturn]] static void init_stage2();
static void setup_serial_debug();
-static void setup_time_management();
VirtualConsole* tty0;
@@ -132,7 +131,7 @@ extern "C" [[noreturn]] void init()
__stack_chk_guard = get_good_random<u32>();
- setup_time_management();
+ TimeManagement::initialize();
new NullDevice;
if (!get_serial_debug())
@@ -356,24 +355,4 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
ASSERT_NOT_REACHED();
return 0;
}
-
-void setup_time_management()
-{
- if (!kernel_command_line().contains("time")) {
- TimeManagement::initialize(true);
- return;
- }
- auto time = kernel_command_line().get("time");
- if (time == "legacy") {
- TimeManagement::initialize(false);
- return;
- }
- if (time == "modern") {
- TimeManagement::initialize(true);
- return;
- }
-
- kprintf("time boot argmuent has an invalid value.\n");
- hang();
-}
}