|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "common/stdint.h"Go to the source code of this file.
Data Structures | |
| struct | ktimespec |
| struct timespec (ABI: long seconds and nanoseconds, as the libc's <time.h> has it). More... | |
Macros | |
| #define | CLOCK_REALTIME 0 |
| the system clocks. | |
| #define | CLOCK_MONOTONIC 1 |
| #define | CLOCK_PROCESS_CPUTIME_ID 2 |
| #define | NSEC_PER_SEC 1000000000u |
Functions | |
| void | clock_init (void) |
| read the wall-clock time from the RTC. | |
| void | clock_init_sleep (void) |
| set up the queue nanosleep sleeps on. | |
| uint32_t | clock_realtime_seconds (void) |
| the wall-clock time in seconds since 1970 (0 if the RTC gave none). | |
| void | clock_ticks_to_timespec (uint64_t ticks, struct ktimespec *out) |
| a timespec from a number of timer ticks. | |
| uint64_t | clock_timespec_to_ticks (const struct ktimespec *span) |
| the timer ticks that cover at least a time span (rounded up). | |
| void | clock_realtime (struct ktimespec *out) |
| the wall-clock time as a timespec. | |
| #define CLOCK_REALTIME 0 |
the system clocks.
CLOCK_REALTIME seconds since 1970 (from the RTC at boot, then the timer ticks) CLOCK_MONOTONIC time since boot; never set, never goes back CLOCK_PROCESS_CPUTIME_ID user and system time of the calling process
the resolution is one timer tick (10 ms at 100 Hz).
| #define CLOCK_MONOTONIC 1 |
| #define CLOCK_PROCESS_CPUTIME_ID 2 |
| #define NSEC_PER_SEC 1000000000u |
| void clock_init | ( | void | ) |
read the wall-clock time from the RTC.
call once at boot.
| void clock_init_sleep | ( | void | ) |
set up the queue nanosleep sleeps on.
call once at boot, before the first nanosleep.
| uint32_t clock_realtime_seconds | ( | void | ) |
the wall-clock time in seconds since 1970 (0 if the RTC gave none).
a timespec from a number of timer ticks.
the timer ticks that cover at least a time span (rounded up).
| void clock_realtime | ( | struct ktimespec * | out | ) |
the wall-clock time as a timespec.
the realtime clock as a timespec: the boot time plus the ticks since.
the wall-clock time as a timespec.