Add package path/filepath; Add os.stat for windows (TODO: unix)

This commit is contained in:
gingerBill
2020-09-25 20:20:53 +01:00
parent 6b634d5e46
commit 8cc5cd1494
13 changed files with 997 additions and 18 deletions
+14
View File
@@ -135,6 +135,20 @@ read_cycle_counter :: proc() -> u64 {
}
unix :: proc(sec: i64, nsec: i64) -> Time {
sec, nsec := sec, nsec;
if nsec < 0 || nsec >= 1e9 {
n := nsec / 1e9;
sec += n;
nsec -= n * 1e9;
if nsec < 0 {
nsec += 1e9;
sec -= 1;
}
}
return Time{(sec*1e9 + nsec) + UNIX_TO_INTERNAL};
}
ABSOLUTE_ZERO_YEAR :: i64(-292277022399); // Day is chosen so that 2001-01-01 is Monday in the calculations
+1 -5
View File
@@ -6,12 +6,8 @@ IS_SUPPORTED :: true;
now :: proc() -> Time {
file_time: win32.FILETIME;
win32.GetSystemTimeAsFileTime(&file_time);
ft := i64(u64(file_time.dwLowDateTime) | u64(file_time.dwHighDateTime) << 32);
ns := (ft - 0x019db1ded53e8000) * 100;
ns := win32.FILETIME_as_unix_nanoseconds(file_time);
return Time{_nsec=ns};
}