It is currently Tue Sep 18, 2018 10:05 pm Advanced search

Timing in C++

Code won't compile? Found a bug? Post here!

Timing in C++

Postby wtarle » Tue Feb 16, 2010 4:59 am

I use clock() to limit my time, but I'm getting suspended all the time. Is there a bug?

It cranks away nicely on my machine. What are you guys using for time?
wtarle
Lieutenant
 
Posts: 15
Joined: Sun Feb 14, 2010 7:18 pm

Re: Timing in C++

Postby iouri_ » Tue Feb 16, 2010 5:33 am

I use clock() too, and I haven't been suspended yet (though I haven't been using it for long). For now I limit my program's run time to 2.5 sec on the first turn and 0.5 sec on the other turns just in case the rounds aren't timed precisely.
iouri_
Brigadier-General
 
Posts: 105
Joined: Thu Feb 11, 2010 4:16 pm
Location: Toronto, Canada

Re: Timing in C++

Postby henrikno » Tue Feb 16, 2010 5:34 am

They are using real time, so try using gettimeofday()
henrikno
Cadet
 
Posts: 9
Joined: Mon Feb 08, 2010 12:52 pm

Re: Timing in C++

Postby ebrahim » Tue Feb 16, 2010 6:01 am

ebrahim
Lieutenant-Colonel
 
Posts: 49
Joined: Mon Feb 08, 2010 7:03 pm


Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron