Global cleanups and standardization of code style.
This commit is contained in:
parent
51a9b4162c
commit
38ef8704f8
33 changed files with 4322 additions and 2824 deletions
|
@ -4,22 +4,25 @@
|
|||
#include "timing.h"
|
||||
#include <sys/time.h>//for gettimeofday
|
||||
#include <time.h>//for time and nanosleep
|
||||
|
||||
/// Sleeps for the indicated amount of milliseconds or longer.
|
||||
void Util::sleep(int ms){
|
||||
if (ms < 0){return;}
|
||||
if (ms > 10000){return;}
|
||||
if (ms < 0){
|
||||
return;
|
||||
}
|
||||
if (ms > 10000){
|
||||
return;
|
||||
}
|
||||
struct timespec T;
|
||||
T.tv_sec = ms/1000;
|
||||
T.tv_nsec = 1000000*(ms%1000);
|
||||
nanosleep(&T, 0);
|
||||
T.tv_sec = ms / 1000;
|
||||
T.tv_nsec = 1000000 * (ms % 1000);
|
||||
nanosleep( &T, 0);
|
||||
}
|
||||
|
||||
/// Gets the current time in milliseconds.
|
||||
long long int Util::getMS(){
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_REALTIME, &t);
|
||||
return ((long long int)t.tv_sec) * 1000 + t.tv_nsec/1000000;
|
||||
return ((long long int)t.tv_sec) * 1000 + t.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
/// Gets the amount of seconds since 01/01/1970.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue