time
This commit is contained in:
@@ -27,14 +27,6 @@ fn void osBarrierWait(Barrier barrier) {
|
||||
}
|
||||
|
||||
// Time
|
||||
fn u64 osTimeMicrosecondsNow() {
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return ((u64)ts.tv_sec * 1000000) + ((u64)ts.tv_nsec / 1000000);
|
||||
}
|
||||
|
||||
#define MICROSECONDS_PER_SECOND 1000000
|
||||
#define NANOSECONDS_PER_MICROSECOND 1000
|
||||
fn void osSleepMicroseconds(u32 t) {
|
||||
struct timespec ts = { t / MICROSECONDS_PER_SECOND, (t % MICROSECONDS_PER_SECOND)*NANOSECONDS_PER_MICROSECOND };
|
||||
nanosleep(&ts, NULL);
|
||||
|
||||
Reference in New Issue
Block a user