mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
Kernel+LibC: Implement clock_gettime() and clock_nanosleep()
Only the CLOCK_MONOTONIC clock is supported at the moment, and it only has millisecond precision. :^)
This commit is contained in:
parent
73b2cb9ed8
commit
cc68654a44
9 changed files with 127 additions and 7 deletions
|
@ -36,15 +36,23 @@ char* asctime(const struct tm*);
|
|||
#define CLOCKS_PER_SEC 1000
|
||||
clock_t clock();
|
||||
|
||||
double difftime(time_t, time_t);
|
||||
size_t strftime(char* s, size_t max, const char* format, const struct tm*);
|
||||
|
||||
#define difftime(t1, t0) (double)(t1 - t0)
|
||||
|
||||
// This is c++11+, but we have no macro for that now.
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
typedef int clockid_t;
|
||||
|
||||
#define CLOCK_MONOTONIC 1
|
||||
#define TIMER_ABSTIME 99
|
||||
|
||||
int clock_gettime(clockid_t, struct timespec*);
|
||||
int clock_nanosleep(clockid_t, int flags, const struct timespec* requested_sleep, struct timespec* remaining_sleep);
|
||||
|
||||
double difftime(time_t, time_t);
|
||||
size_t strftime(char* s, size_t max, const char* format, const struct tm*);
|
||||
|
||||
#define difftime(t1, t0) (double)(t1 - t0)
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue