Update of /cvsroot/pure-data/externals/unauthorized/scratcher~ In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16368/scratcher~
Modified Files: scratcher~.c Log Message: trying out the roast of these NT Tweak .
Index: scratcher~.c =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/scratcher~/scratcher~.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** scratcher~.c 25 Sep 2003 20:58:55 -0000 1.7 --- scratcher~.c 30 May 2004 05:20:01 -0000 1.8 *************** *** 49,53 **** #endif #ifdef NT ! #define M_PI 3.14159265358979323846 #endif #include <math.h> --- 49,54 ---- #endif #ifdef NT ! #include <winsock2.h> ! #include <sys/timeb.h> #endif #include <math.h> *************** *** 326,331 **** --- 327,337 ---- static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy) { + #ifdef NT + time_t et; + struct _timeb tv; + #else struct timeval tv; struct timezone tz; + #endif
// post( "scratcher_motion dx=%f dy=%f", dx, dy ); *************** *** 335,340 **** --- 341,352 ---- x->x_mousemoved = 1; // get current time in ms + #ifdef NT + time( &et ); + _ftime( &tv ); + x->x_lastmovetime = et*1000 + tv.millitm; + #else gettimeofday( &tv, &tz ); x->x_lastmovetime = tv.tv_sec*1000 + tv.tv_usec/1000; + #endif // post( "scratcher~ : move time : %ld", x->x_lastmovetime );
*************** *** 478,483 **** --- 490,500 ---- t_int n = (int)(w[3]); /* number of samples */ t_scratcher *x = (t_scratcher *)(w[4]); + #ifdef NT + time_t et; + struct _timeb tv; + #else struct timeval tv; struct timezone tz; + #endif long long perftime = 0L;
*************** *** 498,503 **** { // get current time in ms ! gettimeofday( &tv, &tz ); ! perftime = tv.tv_sec*1000 + tv.tv_usec/1000; if ( perftime - x->x_lastmovetime > SCRATCHER_MOVE_TIMEOUT ) { --- 515,526 ---- { // get current time in ms ! #ifdef NT ! time( &et ); ! _ftime( &tv ); ! perftime = et*1000 + tv.millitm; ! #else ! gettimeofday( &tv, &tz ); ! perftime = tv.tv_sec*1000 + tv.tv_usec/1000; ! #endif if ( perftime - x->x_lastmovetime > SCRATCHER_MOVE_TIMEOUT ) {