Advertisement
rootuss

Untitled

Mar 26th, 2020
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include "Counter.h"
  2.  
  3. void Counter::startCounter() {
  4.     LARGE_INTEGER li;
  5.     if (!QueryPerformanceFrequency(&li))
  6.         std::cout << " Blad dla QueryPerformanceFrequency!\n";
  7.  
  8.     PCFrequency = double(li.QuadPart) / 1000000.0;      //mikrosekundy
  9.                                                         //1000.0 milisekundy
  10.     QueryPerformanceCounter(&li);
  11.     CounterStart = li.QuadPart;
  12. }
  13.  
  14. double Counter::getCounter() {
  15.     LARGE_INTEGER li;
  16.     QueryPerformanceCounter(&li);
  17.     return double(li.QuadPart - CounterStart) / PCFrequency;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement