remove time stuff from core

This commit is contained in:
krzosa
2025-01-03 14:01:32 +01:00
parent da3fceb19f
commit 1a16255c24
11 changed files with 25 additions and 44 deletions

View File

@@ -32,19 +32,6 @@ fn date_t os_date_now(void) {
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_milliseconds_now(void) {
u64 micros = os_get_microseconds();
f64 result = (f64)micros / 1000.0;
return result;
}
fn void os_error_box(char *str) {
fprintf(stderr, "%s", str);
}

View File

@@ -38,10 +38,6 @@ fn f64 os_parse_float(char *str) {
return wasm_parse_float((isize)str, str_len((char *)str));
}
fn f64 os_milliseconds_now(void) {
return wasm_get_milliseconds();
}
fn void core_init(void) {
isize page_size = kib(64);
isize page_count = __builtin_wasm_memory_size(0);

View File

@@ -32,26 +32,6 @@ fn date_t os_date_now(void) {
return result;
}
fn f64 os_seconds_now(void) {
static int64_t counts_per_second;
if (counts_per_second == 0) {
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
counts_per_second = freq.QuadPart;
}
LARGE_INTEGER time;
QueryPerformanceCounter(&time);
f64 result = (f64)time.QuadPart / (f64)counts_per_second;
return result;
}
fn f64 os_milliseconds_now(void) {
f64 secs = os_seconds_now();
f64 result = secs * 1000;
return result;
}
fn void os_error_box(char *str) {
MessageBoxA(NULL, str, "fatal error", MB_OK);
fprintf(stderr, "%s", str);