code:
//gettimeofday #include <sys/time.h> #include <windows.h> //prototipo int gettimeofday(struct timeval *tp, void *tzp); int gettimeofday(struct timeval* tp, void* tzp){ union { /*tempo passato dal 1 Gennaio 1601 (in centinaia di nanosec) */ long long ns100; FILETIME ft; } _now; GetSystemTimeAsFileTime( &(_now.ft) ); //microsecondi tp->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); //secondi dal 1 gennaio 1970 tp->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); return (0); }