Welcome! Log In Create A New Profile

Advanced

Timers

Posted by AllRight 
Timers
January 06, 2010 03:56AM
how do i make a timer in C?
i have been googling like crazy =D , but they all gave me syntax errors.
kthx
Re: Timers
January 06, 2010 07:20AM
Ooooooooh I had trouble with this one too. I had to delve into the assembly line to make sure it was right, too.

gettime()

This will get the number of "ticks" essentially, since the program started running. Here's my timer code:
 u64 start, diff;     //u64 is defined as: "unsigned long long"
 start = gettime();

 // Stuff I want to time
 // ...

 diff = gettime() - start;

 printf("\n\tTime:%lld", diff);

"ticks_to_millisecs()" will convert it to milliseconds.

Big props to ekeeke for helping me when I needed it here: http://forum.wiibrew.org/read.php?11,42214,42479#msg-42479
Sorry, only registered users may post in this forum.

Click here to login