Hi,
to whom I have to address this patch to get it into simgear-cvs?

Maik

Maik Justus schrieb:
Hi Matthias,

Mathias Fröhlich wrote:
Hi Maik,
On Sunday 13 August 2006 21:15, Maik Justus wrote:
I still have this problem. Can you tell me, where in the source the 10
seconds timeout are tested? Then I can try, to find more detailed
information.
That would be great!
That happens around line 420 in src/MultiPlayer/multiplaymgr.cxx.

    Greetings

           Mathias
The problem is, that the elapsed time is queried in this way
long stamp = timestamper.get_seconds();

but the timestamper update is calculated this way (file timestamp.cxx (simgear)):
void SGTimeStamp::stamp() {
#if defined( WIN32 ) && !defined(__CYGWIN__)
    unsigned int t;
    t = timeGetTime();
seconds = 0; //<<<<<<<---------- comment by Maik: this is the problem
    usec =  t * 1000;
#elif defined( HAVE_GETTIMEOFDAY )
    struct timeval current;
    struct timezone tz;
    // sg_timestamp currtime;
    gettimeofday(&current, &tz);
    seconds = current.tv_sec;
    usec = current.tv_usec;
#elif defined( HAVE_GETLOCALTIME )
    SYSTEMTIME current;
    GetLocalTime(&current);
    seconds = current.wSecond;
    usec = current.wMilliseconds * 1000;
#elif defined( HAVE_FTIME )
    struct timeb current;
    ftime(&current);
    seconds = current.time;
    usec = current.millitm * 1000;
// -dw- uses time manager
#elif defined( macintosh )
    UnsignedWide ms;
    Microseconds(&ms);
        seconds = ms.lo / 1000000;
    usec = ms.lo - ( seconds * 1000000 );
#else
# error Port me
#endif
}
For MSVC the seconds are allways zero, all the elapsed time is stored in usec. After splitting the elapsed time into usec and seconds and removing the " #if defined( WIN32 ) && !defined(__CYGWIN__)" sections alls seems
to work well (see enclosed diff for simgear). Please add it to CVS.

Maik


? timig.diff
Index: timestamp.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/timing/timestamp.cxx,v
retrieving revision 1.5
diff -u -p -r1.5 timestamp.cxx
--- timestamp.cxx       8 Mar 2006 18:16:10 -0000       1.5
+++ timestamp.cxx       20 Aug 2006 14:36:56 -0000
@@ -72,8 +72,8 @@ void SGTimeStamp::stamp() {
 #if defined( WIN32 ) && !defined(__CYGWIN__)
     unsigned int t;
     t = timeGetTime();
-    seconds = 0;
-    usec =  t * 1000;
+    seconds = t / 1000;
+    usec =  (t - seconds * 1000) * 1000;
 #elif defined( HAVE_GETTIMEOFDAY )
     struct timeval current;
     struct timezone tz;
@@ -105,20 +105,12 @@ void SGTimeStamp::stamp() {
 
 // increment the time stamp by the number of microseconds (usec)
 SGTimeStamp operator + (const SGTimeStamp& t, const long& m) {
-#if defined( WIN32 ) && !defined(__CYGWIN__)
-    return SGTimeStamp( 0, t.usec + m );
-#else
     return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000,
                        ( t.usec + m ) % 1000000 );
-#endif
 }
 
 // difference between time stamps in microseconds (usec)
 long operator - (const SGTimeStamp& a, const SGTimeStamp& b)
 {
-#if defined( WIN32 ) && !defined(__CYGWIN__)
-    return a.usec - b.usec;
-#else
     return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec);
-#endif
 }
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to