31 #include <sys/types.h>
36 #endif // HAVE_CONFIG_H
47 struct timeval current;
49 gettimeofday(¤t, NULL);
51 return current.tv_sec + current.tv_usec / 1000000.0;
56 #if defined(HAVE_NANOSLEEP)
58 struct timespec request;
59 request.tv_sec = usec / 1000000;
60 request.tv_nsec = (usec - request.tv_sec * 1000000) * 1000;
62 nanosleep(&request, NULL);
63 #elif defined(__MINGW32__)
66 Sleep((usec + 999) / 1000);
70 #endif // defined(HAVE_NANOSLEEP)
76 setvbuf(stdout, 0, _IONBF, 0);
77 setvbuf(stderr, 0, _IONBF, 0);
80 #if !defined(HAVE_STRTOK_R)
91 char *
strtok_r(
char *str,
const char *delim,
char **nextp)
98 str += strspn(str, delim);
104 str += strcspn(str, delim);
115 #endif // !defined(HAVE_STRTOK_R)