53 bool bestSourceUpdated =
false;
57 bestSourceUpdated =
true;
62 bestSourceUpdated ?
" (selected as best source)" :
"");
129 if (nanoseconds == 0)
137 panic(
NULL,
"sys_time_wait called before timer system initialized");
142 asm volatile(
"pause");
#define SYSCALL_DEFINE(num, returnType,...)
Macro to define a syscall.
void rtc_read(struct tm *time)
Reads the current time from the RTC.
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
#define LOG_INFO(format,...)
uint64_t thread_copy_to_user(thread_t *thread, void *dest, const void *userSrc, uint64_t length)
Safely copy data to user space.
thread_t * sched_thread(void)
Retrieves the currently running thread.
void rwlock_write_acquire(rwlock_t *lock)
Acquires a rwlock for writing, blocking until it is available.
#define RWLOCK_CREATE
Create a rwlock initializer.
#define RWLOCK_READ_SCOPE(lock)
Acquires a rwlock for reading for the reminder of the current scope.
void rwlock_write_release(rwlock_t *lock)
Releases a rwlock from writing.
uint64_t sys_time_register_source(const sys_time_source_t *source)
Register a system timer source.
time_t sys_time_unix_epoch(void)
The unix epoch.
clock_t sys_time_uptime(void)
Time since boot.
#define SYS_TIME_MAX_SOURCES
Maximum amount of system timer sources.
void sys_time_unregister_source(const sys_time_source_t *source)
Unregister a system timer source.
void sys_time_wait(clock_t nanoseconds)
Wait for a specified number of nanoseconds.
#define ENOSPC
No space left on device.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define NULL
Pointer error value.
#define ERR
Integer error value.
__UINT64_TYPE__ clock_t
A nanosecond time.
static sys_time_source_t source
Structure to describe the HPET to the sys time subsystem.
_PUBLIC void * memmove(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
Read-Write Ticket Lock structure.
static bool bootEpochInitialized
static rwlock_t sourcesLock
static void timer_boot_epoch_init(void)
static sys_time_source_t * sources[SYS_TIME_MAX_SOURCES]
static uint32_t sourceCount
static sys_time_source_t * bestSource
_PUBLIC time_t time(time_t *timer)
_PUBLIC time_t mktime(struct tm *timeptr)
long long unsigned time_t