From b05f8113fc20bfd28478fd43d9208a6b3d0e81b3 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Sun, 15 Jul 2007 18:00:20 +0000 Subject: Should compile on MSW now... svn path=/trunk/externals/mrpeach/; revision=8082 --- osc/packOSC.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'osc/packOSC.c') diff --git a/osc/packOSC.c b/osc/packOSC.c index ce73277..1a604a4 100755 --- a/osc/packOSC.c +++ b/osc/packOSC.c @@ -37,12 +37,13 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl #include #include #include -#include #ifdef MSW #include +#include #else #include +#include #endif #ifdef unix @@ -1268,9 +1269,22 @@ static OSCTimeTag OSCTT_Infinite(void) static OSCTimeTag OSCTT_CurrentTimePlusOffset(uint4 offset) { /* offset is in microseconds */ OSCTimeTag tt; + static unsigned int onemillion = 1000000; + static unsigned int onethousand = 1000; +#ifdef MSW + struct _timeb tb; + + _ftime(&tb); + + /* First get the seconds right */ + tt.seconds = (unsigned)SECONDS_FROM_1900_to_1970 + + (unsigned)tb.time+ + (unsigned)offset/onemillion; + /* Now get the fractional part. */ + tt.fraction = (unsigned)tb.millitm*onethousand + (unsigned)(offset%onemillion); /* in usec */ +#else struct timeval tv; struct timezone tz; - static unsigned int onemillion = 1000000; gettimeofday(&tv, &tz); @@ -1282,6 +1296,7 @@ static OSCTimeTag OSCTT_CurrentTimePlusOffset(uint4 offset) (unsigned) offset/onemillion; /* Now get the fractional part. */ tt.fraction = (unsigned) tv.tv_usec + (unsigned)(offset%onemillion); /* in usec */ +#endif if (tt.fraction > onemillion) { tt.fraction -= onemillion; -- cgit v1.2.1