readd seconds stuff

This commit is contained in:
Krzosa Karol
2025-01-05 10:23:41 +01:00
parent 489c8c413e
commit 67f654f72e
6 changed files with 55 additions and 22 deletions

View File

@@ -10,3 +10,16 @@ fn os_date_t os_local_time_now(void) {
result.year = lt->tm_year;
return result;
}
fn u64 os_get_microseconds(void) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
u64 result = t.tv_sec*million(1) + (t.tv_nsec/thousand(1));
return result;
}
fn f64 os_get_milliseconds(void) {
u64 micros = os_get_microseconds();
f64 result = (f64)micros / 1000.0;
return result;
}