On 20 Mar, 12:10, "Nothingman" <nothingma...@poczta.onet.plwrote:
Hi!
I'd like to get time in miliseconds of working some algorithms. Could you
tell me if this program is OK??
#include <windows.h>
The above header marks your program out as being Windows-specific
rather than standard C++.
#include <iostream.h>
And this header is also non-standard. It should be <iostream>. Note
that cout will then be in the std namespace.
int main(int argc, char* argv[])
{
LONGLONG frequency, currentTime, lastTime;
double timeScale;
QueryPerformanceFrequency( (LARGE_INTEGER*) &frequency);
timeScale = (1.0/frequency)*1000.0;
QueryPerformanceCounter( (LARGE_INTEGER*) &lastTime);
some_algorithms();
QueryPerformanceCounter( (LARGE_INTEGER*) ¤tTime);
double milisec = (currentTime-lastTime)*timeScale;
cout << milisec;
return 0;
}
LONGLONG, QueryPerformanceCounter and QueryPerformanceFrequency are
nothing to do with standard C++ and so are off-topic here. The people
who can help you with those will be in a Windows programming
newsgroup. Some suggestions in the FAQ:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
If you do want a standard C++ solution, look at what <time.h(or
<ctime>) provides. It may suit your needs.
Gavin Deane