Adapt to SGTimeStamp changes.
Modified Files: configure.ac src/Cockpit/panel.cxx src/FDM/Makefile.am src/FDM/flight.hxx src/FDM/ExternalNet/ExternalNet.hxx src/Instrumentation/marker_beacon.cxx src/Main/Makefile.am src/Main/fg_init.cxx src/Main/main.cxx src/MultiPlayer/multiplaymgr.cxx src/Time/fg_timer.cxx utils/GPSsmooth/MIDG_main.cxx utils/GPSsmooth/UGear_main.cxx utils/GPSsmooth/gps_main.cxx
This commit is contained in:
parent
391e81f819
commit
f9f9350b96
10 changed files with 23 additions and 26 deletions
|
@ -199,6 +199,7 @@ dnl check for some default libraries
|
|||
AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
|
||||
AC_SEARCH_LIBS(ceil, m)
|
||||
AC_SEARCH_LIBS(dlclose, dl)
|
||||
AC_SEARCH_LIBS(clock_gettime, rt)
|
||||
|
||||
base_LIBS="$LIBS"
|
||||
|
||||
|
|
|
@ -1112,7 +1112,7 @@ FGTextLayer::draw (osg::State& state)
|
|||
text_renderer.start3f(0, 0, 0);
|
||||
|
||||
_now.stamp();
|
||||
long diff = _now - _then;
|
||||
double diff = (_now - _then).toUSecs();
|
||||
|
||||
if (diff > 100000 || diff < 0 ) {
|
||||
// ( diff < 0 ) is a sanity check and indicates our time stamp
|
||||
|
|
|
@ -67,9 +67,7 @@ public:
|
|||
|
||||
bool isDone() const { return done; }
|
||||
bool isDone( long usec ) const {
|
||||
SGTimeStamp now;
|
||||
now.stamp();
|
||||
if ( (now - start) > usec ) {
|
||||
if ( start + SGTimeStamp::fromUSec(usec) < SGTimeStamp::now() ) {
|
||||
return true;
|
||||
} else {
|
||||
return done;
|
||||
|
|
|
@ -175,15 +175,14 @@ FGMarkerBeacon::update(double dt)
|
|||
|
||||
// marker beacon blinking
|
||||
bool light_on = ( outer_blink || middle_blink || inner_blink );
|
||||
SGTimeStamp current;
|
||||
current.stamp();
|
||||
SGTimeStamp current = SGTimeStamp::now();
|
||||
|
||||
if ( light_on && (current - blink > 400000) ) {
|
||||
if ( light_on && blink + SGTimeStamp::fromUSec(400000) < current ) {
|
||||
light_on = false;
|
||||
blink.stamp();
|
||||
} else if ( !light_on && (current - blink > 100000) ) {
|
||||
blink = current;
|
||||
} else if ( !light_on && blink + SGTimeStamp::fromUSec(100000) < current ) {
|
||||
light_on = true;
|
||||
blink.stamp();
|
||||
blink = current;
|
||||
}
|
||||
|
||||
if ( outer_marker ) {
|
||||
|
|
|
@ -273,7 +273,7 @@ static void fgMainLoop( void ) {
|
|||
}
|
||||
current_time_stamp.stamp();
|
||||
/* Convert to ms */
|
||||
double elapsed_us = current_time_stamp - last_time_stamp;
|
||||
double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs();
|
||||
if ( elapsed_us < frame_us ) {
|
||||
double requested_us = frame_us - elapsed_us;
|
||||
ulMilliSecondSleep ( (int)(requested_us / 1000.0) ) ;
|
||||
|
@ -286,7 +286,9 @@ static void fgMainLoop( void ) {
|
|||
// ulMilliSecondSleep() call is omitted this will peg the cpu
|
||||
// (which is just fine if FG is the only app you care about.)
|
||||
current_time_stamp.stamp();
|
||||
while ( current_time_stamp - last_time_stamp < frame_us ) {
|
||||
SGTimeStamp next_time_stamp = last_time_stamp;
|
||||
next_time_stamp += SGTimeStamp::fromSec(1e-6*frame_us);
|
||||
while ( current_time_stamp < next_time_stamp ) {
|
||||
current_time_stamp.stamp();
|
||||
}
|
||||
} else {
|
||||
|
@ -294,8 +296,7 @@ static void fgMainLoop( void ) {
|
|||
current_time_stamp.stamp();
|
||||
}
|
||||
|
||||
real_delta_time_sec
|
||||
= double(current_time_stamp - last_time_stamp) / 1000000.0;
|
||||
real_delta_time_sec = (current_time_stamp - last_time_stamp).toSecs();
|
||||
|
||||
// Limit the time we need to spend in simulation loops
|
||||
// That means, if the /sim/max-simtime-per-frame value is strictly positive
|
||||
|
|
|
@ -712,9 +712,7 @@ FGMultiplayMgr::Update(void)
|
|||
return;
|
||||
|
||||
/// Just for expiry
|
||||
SGTimeStamp timestamper;
|
||||
timestamper.stamp();
|
||||
long stamp = timestamper.get_seconds();
|
||||
long stamp = SGTimeStamp::now().getSeconds();
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Read the receive socket and process any data
|
||||
|
|
|
@ -110,7 +110,7 @@ int fgGetTimeInterval( void ) {
|
|||
interval = 0;
|
||||
} else {
|
||||
current.stamp();
|
||||
interval = current - last;
|
||||
interval = (current - last).toUSecs();
|
||||
last = current;
|
||||
}
|
||||
|
||||
|
|
|
@ -539,13 +539,13 @@ int main( int argc, char **argv ) {
|
|||
|
||||
current_time_stamp.stamp();
|
||||
/* Convert to ms */
|
||||
double elapsed_us = current_time_stamp - last_time_stamp;
|
||||
double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs();
|
||||
if ( elapsed_us < (frame_us - 2000) ) {
|
||||
double requested_us = (frame_us - elapsed_us) - 2000 ;
|
||||
ulMilliSecondSleep ( (int)(requested_us / 1000.0) ) ;
|
||||
}
|
||||
current_time_stamp.stamp();
|
||||
while ( current_time_stamp - last_time_stamp < frame_us ) {
|
||||
while ( (current_time_stamp - last_time_stamp).toUSecs() < frame_us ) {
|
||||
current_time_stamp.stamp();
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,7 @@ int main( int argc, char **argv ) {
|
|||
}
|
||||
|
||||
cout << "Processed " << pos_count << " entries in "
|
||||
<< (current_time_stamp - start_time) / 1000000 << " seconds."
|
||||
<< current_time_stamp - start_time << " seconds."
|
||||
<< endl;
|
||||
} else if ( serialdev.length() ) {
|
||||
// process incoming data from the serial port
|
||||
|
|
|
@ -956,13 +956,13 @@ int main( int argc, char **argv ) {
|
|||
|
||||
current_time_stamp.stamp();
|
||||
/* Convert to ms */
|
||||
double elapsed_us = current_time_stamp - last_time_stamp;
|
||||
double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs();
|
||||
if ( elapsed_us < (frame_us - 2000) ) {
|
||||
double requested_us = (frame_us - elapsed_us) - 2000 ;
|
||||
ulMilliSecondSleep ( (int)(requested_us / 1000.0) ) ;
|
||||
}
|
||||
current_time_stamp.stamp();
|
||||
while ( current_time_stamp - last_time_stamp < frame_us ) {
|
||||
while ( (current_time_stamp - last_time_stamp).toUSecs() < frame_us ) {
|
||||
current_time_stamp.stamp();
|
||||
}
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ int main( int argc, char **argv ) {
|
|||
printf("<gpx>\n");
|
||||
|
||||
cout << "Processed " << imu_count << " entries in "
|
||||
<< (current_time_stamp - start_time) / 1000000 << " seconds."
|
||||
<< current_time_stamp - start_time << " seconds."
|
||||
<< endl;
|
||||
} else if ( serialdev.length() ) {
|
||||
// process incoming data from the serial port
|
||||
|
|
|
@ -465,13 +465,13 @@ int main( int argc, char **argv ) {
|
|||
|
||||
current_time_stamp.stamp();
|
||||
/* Convert to ms */
|
||||
double elapsed_us = current_time_stamp - last_time_stamp;
|
||||
double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs();
|
||||
if ( elapsed_us < (frame_us - 2000) ) {
|
||||
double requested_us = (frame_us - elapsed_us) - 2000 ;
|
||||
ulMilliSecondSleep ( (int)(requested_us / 1000.0) ) ;
|
||||
}
|
||||
current_time_stamp.stamp();
|
||||
while ( current_time_stamp - last_time_stamp < frame_us ) {
|
||||
while ( (current_time_stamp - last_time_stamp).toUSecs() < frame_us ) {
|
||||
current_time_stamp.stamp();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue