PatchworkOS  28a9544
A non-POSIX operating system.
Loading...
Searching...
No Matches
sys_time.h
Go to the documentation of this file.
1#pragma once
2
4#include <kernel/sync/lock.h>
5
6#include <sys/proc.h>
7#include <time.h>
8
9typedef struct cpu cpu_t;
10
28#define SYS_TIME_MAX_SOURCES 8
29
34typedef struct
35{
36 const char* name;
37 clock_t (*read)(void);
40
48
55
62
69
78void sys_time_wait(clock_t nanoseconds);
79
uint64_t sys_time_register_source(const sys_time_source_t *source)
Register a system timer source.
Definition sys_time.c:35
time_t sys_time_unix_epoch(void)
The unix epoch.
Definition sys_time.c:117
clock_t sys_time_uptime(void)
Time since boot.
Definition sys_time.c:106
void sys_time_unregister_source(const sys_time_source_t *source)
Unregister a system timer source.
Definition sys_time.c:67
void sys_time_wait(clock_t nanoseconds)
Wait for a specified number of nanoseconds.
Definition sys_time.c:127
uint64_t read(fd_t fd, void *buffer, uint64_t count)
System call for reading from files.
Definition read.c:9
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition clock_t.h:13
static sys_time_source_t source
Structure to describe the HPET to the sys time subsystem.
Definition hpet.c:185
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
CPU structure.
Definition cpu.h:63
Timer system source.
Definition sys_time.h:35
clock_t precision
Definition sys_time.h:38
const char * name
Definition sys_time.h:36
long long unsigned time_t
Definition time_t.h:4