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"
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
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;
// 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 ) {
}
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) ) ;
// 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 {
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
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
interval = 0;
} else {
current.stamp();
- interval = current - last;
+ interval = (current - last).toUSecs();
last = current;
}
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();
}
}
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
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();
}
}
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
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();
}