Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer

Status
Not open for further replies.

3353

Technical User
Feb 24, 2001
1
MY
hi,

Do anybody knows any APIs besides Sleep() which could be used to set as a timer.
This timer is unlike Sleep() where it should allow other functions codes to operate until the timer period-out.

Your help will be appreciated......thanks in advance...

munhong
 
The high resolution is preferred if available on the system timeGetTime.
Here's an example of usage.

// is there a performance counter available?

if (QueryPerformanceFrequency((LARGE_INTEGER *) &perf_cnt)) {

// yes, set time_count and timer choice flag

perf_flag=TRUE;
time_count=(long) perf_cnt/60;
QueryPerformanceCounter((LARGE_INTEGER *) &next_time);
time_scale=1.0/perf_cnt;

} else {

// no performance counter, read in using timeGetTime

next_time=timeGetTime();
time_scale=0.001;
}

// save time of last frame

last_time=next_time;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top