Advertisement

alternate to timeGetTime()

Started by February 10, 2001 08:05 AM
1 comment, last by redmonkey 23 years, 11 months ago
what alternitives are there for timeGetTime()? it returns the system time in milliseconds, and requires mmsystem.h, im not sure if this is at all a bottleneck in me program, but its not availible on linux, which my game is being ported to is there a united alternitive, or anything better inside windows.h? __________________ graham "red" reeves. red@deadpenguin.org www.deadpenguin.org
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org
clock() from <time.h> is ANSI, but not very accurate (only updated about 15 times per second). Although, it''s quite easy to interpolate the results to make up for the inaccuracy.

Advertisement
You can look into using QueryPerformanceCounter() and QueryPerformanceFrequency(), which are based on the system''s cycle count and cycle frequency, respectively. While these are also Windows-specific functions like timeGetTime(), QueryPerformanceCounter() is based directly on the Pentium RDTSC instruction, so some parallel in Linux should be feasible (even if it means calling the RDTSC assembler instruction directly; I don''t normally use Linux so I can''t speak for whether there are existing GCC functions for this).

This topic is closed to new replies.

Advertisement