package time (windows only at the moment)

This commit is contained in:
gingerBill
2018-12-08 14:32:00 +00:00
parent d05837ab6d
commit 3bf01c8498
2 changed files with 242 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package time
import "core:sys/win32"
now :: proc() -> Time {
file_time: win32.Filetime;
win32.get_system_time_as_file_time(&file_time);
quad := u64(file_time.lo) | u64(file_time.hi) << 32;
UNIX_TIME_START :: 0x019db1ded53e8000;
ns := (1e9/1e7)*(i64(quad) - UNIX_TIME_START);
return Time{_nsec=ns};
}
sleep :: proc(d: Duration) {
win32.Sleep(u32(d/Millisecond));
}