| View previous topic :: View next topic |
| Author |
Message |
Lucas Braesch

Joined: 31 May 2010 Posts: 1824
|
Post subject: Re: Rodent 0.12 Posted: Fri Mar 02, 2012 11:50 am |
|
|
also for the sake of portability (as well as simplicity), you could use the ISO C function clock() instead of all this
| Code: |
int sTimer::GetMS(void)
{
#if defined(_WIN32) || defined(_WIN64)
return GetTickCount();
#else
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
#endif
}
|
while linux gives you nanosecond precision, I don't think windows' GetTickCount has a better resolution than a millisecond (or maybe even 10 ms...), so there's no point in all this complication.
Much easier and fully portable:
| Code: |
#include <time.h>
clock_t start = clock();
...
clock_t stop = clock();
unsigned duration_milliseconds = (stop - start) * 1000 / CLOCKS_PER_SEC;
|
Anyway, I fixed your code and compiled it. I'll test it in my Open Source Bullet rating list. As usual results tomorrow in the tournament forum  |
|
| Back to top |
|
 |
|
| Subject |
Author |
Date/Time |
Rodent 0.12 |
Pawel Koziol |
Wed Feb 29, 2012 9:05 pm |
Re: Rodent 0.12 |
Rémi Coulom |
Wed Feb 29, 2012 9:16 pm |
Re: Rodent 0.12 |
Pawel Koziol |
Wed Feb 29, 2012 9:36 pm |
Re: Rodent 0.12 |
Lucas Braesch |
Thu Mar 01, 2012 10:37 am |
Re: Rodent 0.12 |
Lucas Braesch |
Thu Mar 01, 2012 3:37 pm |
Re: Rodent 0.12 |
Pawel Koziol |
Fri Mar 02, 2012 10:24 am |
Re: Rodent 0.12 |
Lucas Braesch |
Fri Mar 02, 2012 11:23 am |
Re: Rodent 0.12 |
Lucas Braesch |
Fri Mar 02, 2012 11:50 am |
Re: Rodent 0.12 |
Lucas Braesch |
Sat Mar 03, 2012 4:37 am |
Re: Rodent 0.12 |
Martin Sedlak |
Sat Mar 03, 2012 9:19 am |
Re: Rodent 0.12 |
Richard Vida |
Sat Mar 03, 2012 10:28 am |
Re: Rodent 0.12 |
Vincent Diepeveen |
Mon Mar 26, 2012 8:43 pm |
Re: Rodent 0.12 |
Ronald de Man |
Mon Mar 26, 2012 10:01 pm |
Re: Rodent 0.12 |
Vincent Diepeveen |
Mon Mar 26, 2012 10:49 pm |
Re: Rodent 0.12 |
Ronald de Man |
Tue Mar 27, 2012 12:05 am |
Re: Rodent 0.12 |
Vincent Diepeveen |
Wed Mar 28, 2012 10:52 am |
Re: Rodent 0.12 |
Michel Van den Bergh |
Fri Mar 02, 2012 12:03 pm |
Re: Rodent 0.12 |
Pawel Koziol |
Fri Mar 02, 2012 4:39 pm |
Re: Rodent 0.12 |
Jim Ablett |
Fri Mar 02, 2012 10:48 pm |
Re: Rodent 0.12 |
Matthew R. Brades |
Sat Mar 03, 2012 10:25 am |
Re: Rodent 0.12 |
Jim Ablett |
Sat Mar 03, 2012 11:57 am |
Re: Rodent 0.12 |
Graham Banks |
Mon Mar 12, 2012 2:46 am |
Re: Rodent 0.12 |
Pawel Koziol |
Mon Mar 12, 2012 12:57 pm |
Re: Rodent 0.12 |
Graham Banks |
Mon Mar 12, 2012 6:06 pm |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|