title: High resolution timer library in C++ Windows?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1825720/c-high-precision-time-measurement-in-windows">C++ high precision time measurement in Windows</a>  </p>
  </blockquote>
  
  
  
  <p>I am developing a program that downloads files from ftp, and am looking for a High-Res timer library to calculate download speed, for now I am using c++ time(NULL), but results aren't accurate.</p>
  
  <p>Is there a simple/easy to use, plug N play kind of c++ library for windows platform ? Something that gives time elapsed in seconds since last call or something similar.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>So the QueryPerformanceCounter() was mentioned many times, but going through other threads this is what I found out :</p>
  
  <p><em>You should be warned that it is based on the CPU frequency. This frequency is not stable when e.g. a power save mode is enabled. If you want to use this API, make sure the CPU is at a constant frequency.</em></p>
  
  <p><em>Be warned, though, that intel's SpeedStep technology may change the PerformanceFrequency without your code noticing</em></p>
  
  <p>*We also tried fixating the thread affinity for our threads to guarantee that each thread always got a consistent value from QueryPerformanceCounter, this worked but it absolutely killed the performance in the application. *</p>
  
  <p>So considering the situation is it advisable to use it ? The performance of the program and reliablity of the timer is very important</p>