2022-11-19 19:01:01 +00:00
|
|
|
#pragma once
|
2023-06-03 11:15:10 +00:00
|
|
|
#include <bits/timespec.h>
|
2022-12-04 11:42:43 +00:00
|
|
|
#include <luna/Types.h>
|
2022-11-19 19:01:01 +00:00
|
|
|
|
2022-12-05 15:36:41 +00:00
|
|
|
#ifdef ARCH_X86_64
|
|
|
|
#include "arch/x86_64/Timer.h"
|
|
|
|
#else
|
|
|
|
#error "Unknown architecture."
|
|
|
|
#endif
|
2022-11-19 19:01:01 +00:00
|
|
|
|
|
|
|
static const usize MS_PER_SECOND = 1000;
|
|
|
|
static const usize US_PER_SECOND = MS_PER_SECOND * 1000;
|
|
|
|
static const usize NS_PER_SECOND = US_PER_SECOND * 1000;
|
|
|
|
|
|
|
|
namespace Timer
|
|
|
|
{
|
|
|
|
void tick();
|
|
|
|
|
2023-06-03 19:02:18 +00:00
|
|
|
usize ticks_ms();
|
|
|
|
|
2023-06-03 11:15:10 +00:00
|
|
|
struct timespec* monotonic_clock();
|
2022-11-19 19:01:01 +00:00
|
|
|
|
2023-06-03 11:15:10 +00:00
|
|
|
struct timespec* realtime_clock();
|
2022-11-19 19:01:01 +00:00
|
|
|
|
|
|
|
void arch_init();
|
|
|
|
void init();
|
2022-12-07 11:15:30 +00:00
|
|
|
}
|
|
|
|
|
2023-01-02 12:07:29 +00:00
|
|
|
bool should_invoke_scheduler();
|