mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
Add package path/filepath; Add os.stat for windows (TODO: unix)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user