> > For speed reason, you can use GetSystemTimeAsFileTime(), which is > > very efficient. The Win32 is little-endian only operating system. > > You can use the following code. > > > > void gettimeofday(struct timeval* pTv, void *pDummy); > > { > > __int64 l; > > GetSystemTimeAsFileTime((LPFILETIME) &l); > > > > pTv->tv_sec = (long) l / 10000000; /*10e7*/ > > pTv->tv_usec = (unsigned long) (i.QuadPart / 10) % 1000000; /*10e6*/
Could someone on Win32 also compare this to the perl5 version in ext/Time/HiRes.xs? There's no reason to have the perl community running two different versions. In particular, the perl5 version 1. has the correct return type (int instead of void) 2. subtracts EPOCH_BIAS (no, I don't know what that is, but it looks like it might be important.) There are also tiny implementation differences that might be superficial. Without access to a Win32 development system, I have no idea. If this version is better, then let's use it in both places. If the perl5 version is better, let's use *that* in both places. In either case, please remember that many of these wheels have already been invented and tested in perl5-land (S_IRUSR and friends, sleep, gettimeofday, stat, fwrite, etc.). We can save ourselves a lot of grief by simply borrowing what we know works. -- Andy Dougherty [EMAIL PROTECTED] Dept. of Physics Lafayette College, Easton PA 18042