Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / High precision timer

Author
Message
Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 25th Jan 2005 10:43 Edited at: 25th Jan 2005 14:00
Well I know some of you are unhappy with the current timer function so here is one that is 6 more digits. It calls your cpu timer directly. Unlike the kernel ticker which which is in 1ms increments(supposed to be) and only gets updated whenever the OS feels like it, the cpu never stops ticking.




Mason
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 25th Jan 2005 11:18 Edited at: 25th Jan 2005 11:18
Hmm, didn't seem to work properly. I used it in Dark Basic Pro if that matters. Its 8:17 pm here and it is giving me

-1530.999 1001


I'm not exactly what happened there. Good Idea Though.

Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 25th Jan 2005 11:26
Ah, you must be using a pentium? No? My goof for posting without testing different cpu's. I have amd 2600. Let me see if it can be self adjusting.


Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 25th Jan 2005 11:51
I changed the code so that the frequency is unsigned and tested it on my pentium 800 mhz. The difference in time should now represent true time compared to kernel ticks. Kernel ticks are not accurate. Depending on what the OS is doing it may or maynot be updated correctly. I've gotten a 500ms difference on XP before. Am hoping nobodys counter runs faster than what a dword can hold.


Login to post a reply

Server time is: 2024-11-23 16:49:59
Your offset time is: 2024-11-23 16:49:59