Any good timers?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Any good timers?

Post 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.
jwatson1993
Posts: 37
Joined: Fri Nov 04, 2011 12:15 am

Re: Any good timers?

Post 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.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Any good timers?

Post by mongoose7 »

On Windows you probably need to enable the high-resolution timer.
tank202
Competition winner
Posts: 40
Joined: Mon Jan 21, 2013 8:34 pm
Location: Lithuania, Kaunas

Re: Any good timers?

Post 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
Klunk
Posts: 264
Joined: Mon Jan 10, 2011 5:21 pm

Re: Any good timers?

Post by Klunk »

roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Re: Any good timers?

Post 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.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Any good timers?

Post 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.
Post Reply