This commit is contained in:
Tenari
2026-07-02 08:59:18 -05:00
parent 87c180bda9
commit 71552a57de
5 changed files with 64 additions and 14 deletions
-8
View File
@@ -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);