Jump to content
  • Advertisement
Sign in to follow this  

timing events...

This topic is 4961 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I wanted to know if there was a function to get the amount of seconds the application of mine has been running. GetTickCount doesn't work, b/c it just generates milliseconds which isn't accurate b/c every second is like some odd 54,000 milliseconds when u use it. So is there a way where I could have an int time = sometimefuction();? I'm trying to create a timing even so every few seconds it does a different action. Thanks in advance.

Share this post

Link to post
Share on other sites
Hmmm.. That's strange.. Since there are only 1000 milliseconds in a second. Anyhow, you could look into a high resolution timer:

#include <windows.h>

void main() {

LARGE_INTEGER freq,start,stop;

// Initialize the "timer"

// Start the "timer"

// Do stuff

// Stop the timer

int secondsElapsed = int((stop.QuadPart - start.QuadPart) / float(freq.QuadPart));

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!