From c65cd3254b4f21639aa5290fd781d5220f922e4d Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 7 Jul 2000 23:56:43 +0000 Subject: [PATCH] More tidying up of SGTime. --- src/Main/bfi.cxx | 2 -- src/Main/main.cxx | 15 ++++++++------- src/Main/options.cxx | 8 ++------ src/Time/tmp.cxx | 5 ++++- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Main/bfi.cxx b/src/Main/bfi.cxx index 180edc244..1c0be1174 100644 --- a/src/Main/bfi.cxx +++ b/src/Main/bfi.cxx @@ -397,8 +397,6 @@ FGBFI::setTimeGMT (time_t time) current_options.get_fg_root() ); globals->get_time_params()->update( cur_fdm_state->get_Longitude(), cur_fdm_state->get_Latitude(), - cur_fdm_state->get_Altitude() - * FEET_TO_METER, globals->get_warp() ); needReinit(); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index fb71bb98c..1a93b585d 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -798,7 +798,6 @@ static void fgMainLoop( void ) { t->update( cur_fdm_state->get_Longitude(), cur_fdm_state->get_Latitude(), - cur_fdm_state->get_Altitude()* FEET_TO_METER, globals->get_warp() ); if ( globals->get_warp_delta() != 0 ) { @@ -1310,15 +1309,17 @@ int main( int argc, char **argv ) { guiInit(); // Initialize time - SGTime *t = new SGTime( current_options.get_fg_root() ); - t->init( 0.0, 0.0, current_options.get_fg_root() ); + FGPath zone( 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 time_t cur_time = t->get_cur_time(); - time_t currGMT = t->get_gmt( gmtime(&cur_time) ); - time_t systemLocalTime = t->get_gmt( localtime(&cur_time) ); + time_t currGMT = sgTimeGetGMT( gmtime(&cur_time) ); + time_t systemLocalTime = sgTimeGetGMT( localtime(&cur_time) ); 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 switch ( current_options.get_time_offset_type() ) { @@ -1355,7 +1356,7 @@ int main( int argc, char **argv ) { 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 ); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 321d134dc..15f4851c2 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -433,12 +433,8 @@ long int fgOPTIONS::parse_date( const string& date) num[i] = '\0'; gmt.tm_sec = atoi(num); } - time_t theTime = globals->get_time_params()->get_gmt(gmt.tm_year, - gmt.tm_mon, - gmt.tm_mday, - gmt.tm_hour, - gmt.tm_min, - gmt.tm_sec); + time_t theTime = sgTimeGetGMT( gmt.tm_year, gmt.tm_mon, gmt.tm_mday, + gmt.tm_hour, gmt.tm_min, gmt.tm_sec ); //printf ("Date is %s\n", ctime(&theTime)); //printf ("in seconds that is %d\n", theTime); //exit(1); diff --git a/src/Time/tmp.cxx b/src/Time/tmp.cxx index 988a5f3b3..5d7ff2d34 100644 --- a/src/Time/tmp.cxx +++ b/src/Time/tmp.cxx @@ -25,6 +25,7 @@ # include #endif +#include #include #include @@ -57,10 +58,12 @@ FGMagVar cur_magvar; // periodic time updater wrapper void fgUpdateLocalTime() { + FGPath zone( current_options.get_fg_root() ); + zone.append( "Timezone" ); globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(), cur_fdm_state->get_Latitude(), - current_options.get_fg_root() ); + zone.str() ); } -- 2.39.5