text: : > ----------------------------------------- > #include <iostream> > #include <ctime> > > using namespace std; > > int main() > { > time_t t0 = time(0); > clock_t c0 = clock(); > > for (int i = 0; i < 10; ++i) > { > cout << "push > " << flush; > char a; > cin >> a; > cout << endl; > } > > cout << "Difference in wall clock is " > << difftime(time(0), t0) << endl; > cout << "Difference in CPU ticks is " > << double(clock() - c0) / CLOCKS_PER_SEC << endl; > > return 0; > } > ------------------------------------------- > and got very similar values on Windows and quite different > values on Unix. It seems that on Windows it just takes the > time() at the beginning and then 'clock' simply takes the > difference between current time and the stored value and > multiplies it with CLOCKS_PER_SEC... > > I know of GetProcessTimes() function, but couldn't 'clock()' > be implemented to use it? > > Thanks. > > Victor Windows 2000. The problem is not only with VC++ RTL. The program has been compiled: * with Microsoft C++ 13.00.9466 for 80x86 cl /EHsc program.cpp -o a_ms.exe * with gcc version 3.3.1 (cygming special) g++ -mno-cygwin -o a_mgw program.cpp // Use the Mingw32 interface g++ -o a_cyg program.cpp // Cygwin Here are results: $ a_ms [---omitted---] Difference in wall clock is 11 Difference in CPU ticks is 11.847 $ a_mgw [---omitted---] Difference in wall clock is 10 Difference in CPU ticks is 10.925 $ a_cyg [---omitted---] Difference in wall clock is 9 Difference in CPU ticks is 0.03 Here are DLLs: a_ms.exe C:\WINNT\system32\KERNEL32.dll C:\WINNT\system32\NTDLL.DLL a_mgw.exe C:\WINNT\system32\msvcrt.dll C:\WINNT\system32\KERNEL32.dll C:\WINNT\system32\NTDLL.DLL a_cyg.exe It seems that the problem is in DLLs (?). -- Alex Vinokur -- Unsubscribe info: Problem reports: Documentation: FAQ: