Advertisement
m4ly

Miliseconds

Nov 13th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include "Windows.h"
  2.  
  3. long long milliseconds_now() {
  4.     static LARGE_INTEGER s_frequency;
  5.     static BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency);
  6.     if (s_use_qpc) {
  7.         LARGE_INTEGER now;
  8.         QueryPerformanceCounter(&now);
  9.         return (1000LL * now.QuadPart) / s_frequency.QuadPart;
  10.     }
  11.     else {
  12.         return GetTickCount();
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement