blob: 239b389880db540ee6b350627729afc431ba5f0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <errno.h>
#include <stdint.h>
#include <syscall.h>
#include <time.h>
#include <unistd.h>
int clock_gettime(clockid_t clock_id, struct timespec *tp) {
uint32_t ms = uptime();
tp->tv_sec = ms / 1000;
tp->tv_nsec = ms * 1000000;
RC_ERRNO(syscall(SYS_CLOCK_GETTIME, clock_id, tp, 0, 0, 0));
}
|