Page 1 of 1

ticks or any timer?

Posted: Thu Jun 04, 2009 7:04 pm
by ozzyyzzo
Hi,

i would like to get current tick or any elapsed time available.
a fine granularity is welcome :)

thx

Re: ticks or any timer?

Posted: Fri Jun 05, 2009 4:42 pm
by weirdfox
I use the NDS timers to do that, just set one of the timers to 1000Hz and it should be able to give you a good representation of the current ms tick.

I made a simple class to wrap the "Tick" manipulation that I'm willing to share, if you want it :D

Re: ticks or any timer?

Posted: Fri Jun 05, 2009 10:18 pm
by ozzyyzzo
Thanks for the answer!

and using gettick() function is just was i was searching for..

as i'm completely lazy i'm also using this copy/pasted macro :
#define OS_BUS_CLOCK 243000000u
#define OS_TIMER_CLOCK (OS_BUS_CLOCK/4)

#define OSTicksToMilliseconds( ticks ) ((ticks) / (OS_TIMER_CLOCK / 1000))

maybe it's completely wrong, maybe not. i'll test it later on. ^^