// // OS_Delta_Time: C // // Return time difference in microseconds. If base = 0, then // return the counter. If base != 0, compute the time difference. // // Note: Requires high performance timer. // Q: If not found, use timeGetTime() instead ?! // i64 OS_Delta_Time(i64 base, int flags) { LARGE_INTEGER freq; LARGE_INTEGER time; if (!QueryPerformanceCounter(&time)) OS_Crash(cb_cast("Missing resource"), cb_cast("High performance timer")); if (base == 0) return time.QuadPart; // counter (may not be time) QueryPerformanceFrequency(&freq); return ((time.QuadPart - base) * 1000) / (freq.QuadPart / 1000); }
*/ i64 OS_Delta_Time(i64 base, int flags) /* ** Return time difference in microseconds. If base = 0, then ** return the counter. If base != 0, compute the time difference. ** ** Note: Requires high performance timer. ** Q: If not found, use timeGetTime() instead ?! ** ***********************************************************************/ { LARGE_INTEGER freq; LARGE_INTEGER time; if (!QueryPerformanceCounter(&time)) OS_Crash(cb_cast("Missing resource"), "High performance timer"); if (base == 0) return time.QuadPart; // counter (may not be time) QueryPerformanceFrequency(&freq); return ((time.QuadPart - base) * 1000) / (freq.QuadPart / 1000); }
/* coverity[+kill] */ void Host_Crash(const char *reason) { OS_Crash(cb_cast("REBOL Host Failure"), cb_cast(reason)); }
/* coverity[+kill] */ void Host_Crash(REBYTE *reason) { OS_Crash("REBOL Host Failure", reason); }