Page 1 of 1

Any good timers?

Posted: Tue Oct 29, 2013 12:51 pm
by The_Glitch
My project is a screensaver and I need a good method for retrieving if a certain amount of time has passed, windows requires this for the screensaver to close. I'm sure this community already has one so I'd save some time by asking the simplest efficient way of doing this.

Re: Any good timers?

Posted: Wed Oct 30, 2013 4:42 am
by jwatson1993
Irrlicht's device has a timer built into it. just do

Code: Select all

irrlichtdevice->getTimer();
. It keeps track of how many milliseconds have passed since the program opened, and can be stopped and started.

Re: Any good timers?

Posted: Wed Oct 30, 2013 8:03 am
by mongoose7
On Windows you probably need to enable the high-resolution timer.

Re: Any good timers?

Posted: Wed Oct 30, 2013 1:23 pm
by tank202
I myself always use native c++ "chrono" namespace timers. There are several types of them so I think you should find what you're looking among them.

Just google "c++ chrono" :D

Re: Any good timers?

Posted: Mon Nov 04, 2013 1:11 pm
by Klunk

Re: Any good timers?

Posted: Mon Nov 04, 2013 4:09 pm
by roxaz
all that high precision and perf counters are overkill, seriously. irrlicht uses GetTickCount() under the hood when not using high performance timer. GetTickCount() has 15ms resolution. That is plenty for just about anything.

Re: Any good timers?

Posted: Tue Nov 05, 2013 1:48 am
by mongoose7
You only have to *enable* the high-performance timer and GetTickCount will have millisecond accuracy. You don't have to *use* the HP timer.