[cultura informatica] Epoch
Posted by cato on 31-03-2005 16:06
perche per windows epoch è il 1601 e per unix il 1970?

se devo convertire l'ephoc di windows in unix

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); }


è giusto,grazie?
Powered by: vbHome (lite) v3.8 and vBulletin v2.3.1
Copyright © 2000 - 2002 Jelsoft Enterprises Limited