#!/usr/bin/perl -I/var/www/adp-gmbh/cgi-bin -w use ADP_CGI; Title('A Stop Watch class for C++'); Code '#include class StopWatch { LARGE_INTEGER frequency_; LARGE_INTEGER startTime_; LARGE_INTEGER stopTime_; public: StopWatch(); void Start(); void Stop(); __int64 MilliSeconds() const; }; StopWatch::StopWatch() { if (!::QueryPerformanceFrequency(&frequency_)) throw "Error with QueryPerformanceFrequency"; } void StopWatch::Start() { ::QueryPerformanceCounter(&startTime_); } void StopWatch::Stop() { ::QueryPerformanceCounter(&stopTime_); } __int64 StopWatch::MilliSeconds() const { return (float)(stopTime_.QuadPart - startTime_.QuadPart) / (float) frequency_.QuadPart * 1000; } #include using namespace std; int main(int argc, char* argv[]) { StopWatch stopWatch; stopWatch.Start(); Sleep(1); stopWatch.Stop(); cout << (int) stopWatch.MilliSeconds() << endl; return 0; } '; PImproveSite();