HOw do I convert from TickCounts to Milliseconds?
this is what I used:
long int before = GetTickCount();
long int after = GetTickCount();
I want the difference of it in seconds.
Thanks!
HOw do I convert from TickCounts to Milliseconds?
this is what I used:
long int before = GetTickCount();
long int after = GetTickCount();
I want the difference of it in seconds.
Thanks!
I'm not sure what OS/platform you're using, but there should be a call that returns the tick time in milliseconds.
time = after - before * <tick time in milliseconds>;
I see that this is a Windows function that returns milliseconds already. The other answers are better.
GetTickCount() returns the time in milliseconds. so (after - before)/<milli equivalent>
should give you time in seconds
Did you try use boost? There is a type time_duration for this, and functions like seconds(), nanoseconds(), miliseconds()
int seconds = (after - before + 500) / 1000;
or:
double seconds = (after - before) / 1000.0;