14#if defined(__windows__)
23 ft.QuadPart = -(10 * usec);
25 timer = CreateWaitableTimer(NULL, TRUE, NULL);
26 SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
27 WaitForSingleObject(timer, INFINITE);
46 printf(
"Press a enter to continue...");
49 int n = scanf(
"%c", k);
53 }
else if (error != 0) {
54 n_log(
LOG_ERR,
"error %s when waiting for a key !", strerror(error));
71#if defined(__windows__)
72 if (QueryPerformanceFrequency((LARGE_INTEGER*)&timer->freq) == 0)
74 if (QueryPerformanceCounter(&timer->
startTime) == 0)
77 if (gettimeofday(&timer->
startTime, 0) != 0)
91 QueryPerformanceCounter((LARGE_INTEGER*)&timer->
currentTime);
111 QueryPerformanceCounter((LARGE_INTEGER*)&timer->
currentTime);
131 QueryPerformanceCounter((LARGE_INTEGER*)&timer->
currentTime);
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_DEBUG
debug-level messages
#define LOG_ERR
error conditions
struct timeval startTime
start time
time_t delta
time since last poll
struct timeval currentTime
start time
void u_sleep(unsigned int usec)
wrapper around usleep for API consistency
int start_HiTimer(N_TIME *timer)
Initialize or restart from zero any N_TIME HiTimer.
time_t get_usec(N_TIME *timer)
Poll any N_TIME HiTimer, returning usec, and moving currentTime to startTime.
time_t get_msec(N_TIME *timer)
Poll any N_TIME HiTimer, returning msec, and moving currentTime to startTime.
time_t get_sec(N_TIME *timer)
Poll any N_TIME HiTimer, returning sec, and moving currentTime to startTime.
void PAUSE(void)
make a pause in a terminal