Richard --

Thanks. Applied.

NOTE: I put the code in time.c in a function Parrot_floatval_time().

Some Win32 person please see if that can be made to work. Patches
to make it actually work are hereby solicited.


Regards,

-- Gregor

On Thu, 2001-11-01 at 16:48, Richard J Cox wrote:
> Current get fails to build on Win32[1]
> 
> There are a host of problems (not the least being the object files not 
> going where the linker is expecting them), then aside the first is the 
> lack of a gettimeofday function. This is used in time_n.
> 
> Here's my Win32 version:
> 
> void gettimeofday(struct timeval* pTv, void *pDummy);
> {
>     SYSTEMTIME sysTime;
>     FILETIME fileTime;        /* 100ns == 1 */
>     LARGE_INTEGER i;
> 
>     GetSystemTime(&sysTime);
>     SystemTimeToFileTime(&sysTime, &fileTime);
>     /* Documented as the way to get a 64 bit from a FILETIME. */
>     memcpy(&i, &fileTime, sizeof(LARGE_INTEGER));
> 
>     pTv->tv_sec = i.QuadPart / 10000000; /*10e7*/
>     pTv->tv_usec = (i.QuadPart / 10) % 1000000; /*10e6*/
> 
> }
> 
> Given a suitable definition of struct timeval for the prototype (there is 
> a definition in windows.h[2]) but making Windows.h a header across all the 
> builds causes its own problems (with BOOL for a start).
> 
> I'm not sure what a timeval of {0, 0} nominally represents, the above will 
> give seconds since 1 Jan 1601, so a fiddle factor is likely to be needed.
> 
> (I'm not sure what the best way to incorporate this is... for my test I 
> added an extra .c with a special include, but I think some form of common 
> OS abstraction layer is going to be needed rather than assuming one 
> ABI/API and then emulating elsewhere.)
> 
> 
> [1] Windows 2000, Visual Studio 6 SP5 & MS Platform SDK (Feb 01 edition)
> [2] Well, more correctly in winsock2.h which windows.h includes.
> -- 
> [EMAIL PROTECTED]
> 
> 
-- 
 _____________________________________________________________________ 
/     perl -e 'srand(-2091643526); print chr rand 90 for (0..4)'      \

   Gregor N. Purdy                          [EMAIL PROTECTED]
   Focus Research, Inc.                http://www.focusresearch.com/
   8080 Beckett Center Drive #203                   513-860-3570 vox
   West Chester, OH 45069                           513-860-3579 fax
\_____________________________________________________________________/

Reply via email to