mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 18:55:07 +00:00
Kernel: Simplify the Time management initialization
This commit is contained in:
parent
8e336798b5
commit
a7c5a1fe69
3 changed files with 7 additions and 25 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue