Linux:
struct timeval tv;
gettimeofday(&tv, NULL);
printf("sec = %d, ms = %d\n", tv.tv_sec, tv.tv_usec / 1000);
Windows:
#include <sys/timeb.h>
struct timeb tp;
ftime(&tp);
printf("sec = %d, ms = %d\n", tp.time, tp.millitm);
Linux:
struct timeval tv;
gettimeofday(&tv, NULL);
printf("sec = %d, ms = %d\n", tv.tv_sec, tv.tv_usec / 1000);
Windows:
#include <sys/timeb.h>
struct timeb tp;
ftime(&tp);
printf("sec = %d, ms = %d\n", tp.time, tp.millitm);