ticks or any timer?

Post Reply
ozzyyzzo
Posts: 19
Joined: Wed Jun 03, 2009 7:23 pm
Location: greece

ticks or any timer?

Post by ozzyyzzo » Thu Jun 04, 2009 7:04 pm

Hi,

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

thx

weirdfox
Posts: 29
Joined: Thu Feb 19, 2009 8:45 am
Location: Montreal, Canada
Contact:

Re: ticks or any timer?

Post by weirdfox » Fri Jun 05, 2009 4:42 pm

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
try, crash, debug and learn :)

ozzyyzzo
Posts: 19
Joined: Wed Jun 03, 2009 7:23 pm
Location: greece

Re: ticks or any timer?

Post by ozzyyzzo » Fri Jun 05, 2009 10:18 pm

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. ^^

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests