More tidying up of SGTime.
This commit is contained in:
parent
312626c5f0
commit
c65cd3254b
4 changed files with 14 additions and 16 deletions
|
@ -397,8 +397,6 @@ FGBFI::setTimeGMT (time_t time)
|
||||||
current_options.get_fg_root() );
|
current_options.get_fg_root() );
|
||||||
globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
|
globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
|
||||||
cur_fdm_state->get_Latitude(),
|
cur_fdm_state->get_Latitude(),
|
||||||
cur_fdm_state->get_Altitude()
|
|
||||||
* FEET_TO_METER,
|
|
||||||
globals->get_warp() );
|
globals->get_warp() );
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,7 +798,6 @@ static void fgMainLoop( void ) {
|
||||||
|
|
||||||
t->update( cur_fdm_state->get_Longitude(),
|
t->update( cur_fdm_state->get_Longitude(),
|
||||||
cur_fdm_state->get_Latitude(),
|
cur_fdm_state->get_Latitude(),
|
||||||
cur_fdm_state->get_Altitude()* FEET_TO_METER,
|
|
||||||
globals->get_warp() );
|
globals->get_warp() );
|
||||||
|
|
||||||
if ( globals->get_warp_delta() != 0 ) {
|
if ( globals->get_warp_delta() != 0 ) {
|
||||||
|
@ -1310,15 +1309,17 @@ int main( int argc, char **argv ) {
|
||||||
guiInit();
|
guiInit();
|
||||||
|
|
||||||
// Initialize time
|
// Initialize time
|
||||||
SGTime *t = new SGTime( current_options.get_fg_root() );
|
FGPath zone( current_options.get_fg_root() );
|
||||||
t->init( 0.0, 0.0, current_options.get_fg_root() );
|
zone.append( "Timezone" );
|
||||||
|
SGTime *t = new SGTime( zone.str() );
|
||||||
|
t->init( 0.0, 0.0, zone.str() );
|
||||||
|
|
||||||
// Handle potential user specified time offsets
|
// Handle potential user specified time offsets
|
||||||
time_t cur_time = t->get_cur_time();
|
time_t cur_time = t->get_cur_time();
|
||||||
time_t currGMT = t->get_gmt( gmtime(&cur_time) );
|
time_t currGMT = sgTimeGetGMT( gmtime(&cur_time) );
|
||||||
time_t systemLocalTime = t->get_gmt( localtime(&cur_time) );
|
time_t systemLocalTime = sgTimeGetGMT( localtime(&cur_time) );
|
||||||
time_t aircraftLocalTime =
|
time_t aircraftLocalTime =
|
||||||
t->get_gmt( fgLocaltime(&cur_time, t->get_zonename() ) );
|
sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
|
||||||
|
|
||||||
// Okay, we now have six possible scenarios
|
// Okay, we now have six possible scenarios
|
||||||
switch ( current_options.get_time_offset_type() ) {
|
switch ( current_options.get_time_offset_type() ) {
|
||||||
|
@ -1355,7 +1356,7 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
globals->set_warp_delta( 0 );
|
globals->set_warp_delta( 0 );
|
||||||
|
|
||||||
t->update( 0.0, 0.0, 0.0, globals->get_warp() );
|
t->update( 0.0, 0.0, globals->get_warp() );
|
||||||
|
|
||||||
globals->set_time_params( t );
|
globals->set_time_params( t );
|
||||||
|
|
||||||
|
|
|
@ -433,12 +433,8 @@ long int fgOPTIONS::parse_date( const string& date)
|
||||||
num[i] = '\0';
|
num[i] = '\0';
|
||||||
gmt.tm_sec = atoi(num);
|
gmt.tm_sec = atoi(num);
|
||||||
}
|
}
|
||||||
time_t theTime = globals->get_time_params()->get_gmt(gmt.tm_year,
|
time_t theTime = sgTimeGetGMT( gmt.tm_year, gmt.tm_mon, gmt.tm_mday,
|
||||||
gmt.tm_mon,
|
gmt.tm_hour, gmt.tm_min, gmt.tm_sec );
|
||||||
gmt.tm_mday,
|
|
||||||
gmt.tm_hour,
|
|
||||||
gmt.tm_min,
|
|
||||||
gmt.tm_sec);
|
|
||||||
//printf ("Date is %s\n", ctime(&theTime));
|
//printf ("Date is %s\n", ctime(&theTime));
|
||||||
//printf ("in seconds that is %d\n", theTime);
|
//printf ("in seconds that is %d\n", theTime);
|
||||||
//exit(1);
|
//exit(1);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <simgear/misc/fgpath.hxx>
|
||||||
#include <simgear/magvar/magvar.hxx>
|
#include <simgear/magvar/magvar.hxx>
|
||||||
|
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
@ -57,10 +58,12 @@ FGMagVar cur_magvar;
|
||||||
|
|
||||||
// periodic time updater wrapper
|
// periodic time updater wrapper
|
||||||
void fgUpdateLocalTime() {
|
void fgUpdateLocalTime() {
|
||||||
|
FGPath zone( current_options.get_fg_root() );
|
||||||
|
zone.append( "Timezone" );
|
||||||
|
|
||||||
globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),
|
globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),
|
||||||
cur_fdm_state->get_Latitude(),
|
cur_fdm_state->get_Latitude(),
|
||||||
current_options.get_fg_root() );
|
zone.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue