|
How much time |
Decelion
Member #8,193
January 2007
|
Hi! I'm new to allegro and now I have the first problem that I can't bring away myself. //Here I want to start the timer //...code... //and here I want to know how much time is left since I started the timer. How can I do this? Thank you, Decelion PS: Sorry for my English being not very good sometimes, I am from Germany. If you find mistakes, please tell me. |
ixilom
Member #7,167
April 2006
|
You can use the clock() function from time.h to check the duration.
___________________________________________ |
Johan Halmén
Member #1,550
September 2001
|
Well, you could use allegro timer stuff:
What happens is you
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
James Stanley
Member #7,275
May 2006
|
If you want to time how long the program takes to execute (which you probably don't. You're probably doing a fps count), you can execute it with time. Instead of 'myprogram', you type 'time myprogram', and it will tell you the time at the bottom. I don't think Windows has this, though, so if you want to be portable use Allegro timers. EDIT: Quote: unsigned int my_time; Doesn't it need to be volatile? |
Decelion
Member #8,193
January 2007
|
Ok, thank you very much! |
Johan Halmén
Member #1,550
September 2001
|
Quote: Doesn't it need to be volatile? Yes, I think so. Just for sure. If you have heavy optimization on, your compiler might make your application reuse the memory space of the variable, if you don't declare it volatile. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
nonnus29
Member #2,606
August 2002
|
Quote:
Ok, thank you very much! L0L, a sense of humor is very important, good luck! |
Paul whoknows
Member #5,081
September 2004
|
Profiling can be useful too. ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
|