* autoload.cc (winmm): Remove time functions. Don't treat
unloadable wave functions as fatal. * hires.h (hires_ms::timeGetTime_ns): New private method. (hires_ms::dmsecs): Call timeGetTime_ns here. * ntdll.h (struct _KSYSTEM_TIME): Define. (KUSER_SHARED_DATA): Redefine to allow access to InterruptTime. (SharedUserData): Define here. (NtQueryTimerResolution): Declare. (NtSetTimerResolution): Declare. * path.cc (SharedUserData): Move to ntdll.h. * times.cc (hires_ms::timeGetTime_ns): New private method. Use throughout instead of timeGetTime. Document entire functionality of timeGetTime in case we need it. (hires_ms::resolution): Try a call to NtQueryTimerResolution to fetch current period. Fall back to heuristic if that fails. Cast to DWORD in assignments to minperiod. (clock_setres): Align period to possible values per a call to NtQueryTimerResolution. Explain why. Replace calls to timeBeginPeriod and timeEndPeriod with underlying call to NtSetTimerResolution. Use status code from NtSetTimerResolution to compute errno. Convert period to ULONGLONG and store 100ns value to simplify code.
This commit is contained in:
@@ -43,12 +43,13 @@ class hires_ns : public hires_base
|
||||
class hires_ms : public hires_base
|
||||
{
|
||||
LONGLONG initime_ns;
|
||||
LONGLONG timeGetTime_ns ();
|
||||
void prime ();
|
||||
public:
|
||||
LONGLONG nsecs ();
|
||||
LONGLONG usecs () {return nsecs () / 10LL;}
|
||||
LONGLONG msecs () {return nsecs () / 10000LL;}
|
||||
UINT dmsecs () { return timeGetTime (); }
|
||||
UINT dmsecs () { return timeGetTime_ns () / 10000LL; }
|
||||
UINT resolution ();
|
||||
LONGLONG uptime () {return (nsecs () - initime_ns) / 10000LL;}
|
||||
};
|
||||
|
Reference in New Issue
Block a user