]> git.mxchange.org Git - flightgear.git/blobdiff - src/Time/tmp.cxx
Added static port system and a new altimeter model connected to it.
[flightgear.git] / src / Time / tmp.cxx
index 988a5f3b315ff0a2a9d23feaeaa9906d395b1b05..806c659ed05e2e385dcc5e227fa80f6033cb2f28 100644 (file)
 #  include <config.h>
 #endif
 
+#include <simgear/misc/sg_path.hxx>
 #include <simgear/magvar/magvar.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <FDM/flight.hxx>
+#include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
-#include <Main/options.hxx>
 
 #include "light.hxx"
 #include "moonpos.hxx"
 #include "tmp.hxx"
 
 
-FGMagVar::FGMagVar() {
-}
-
-FGMagVar::~FGMagVar() {
-}
-
-
-void FGMagVar::update( double lon, double lat, double alt_m, double jd ) {
-    // Calculate local magnetic variation
-    double field[6];
-    // cout << "alt_m = " << alt_m << endl;
-    magvar = SGMagVar( lat, lon, alt_m / 1000.0, (long)jd, field );
-    magdip = atan(field[5]/sqrt(field[3]*field[3]+field[4]*field[4]));
-}
-
-FGMagVar cur_magvar;
-
-
 // periodic time updater wrapper
 void fgUpdateLocalTime() {
-
-    globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),
-                                            cur_fdm_state->get_Latitude(),
-                                            current_options.get_fg_root() );
+    static const SGPropertyNode *longitude
+       = fgGetNode("/position/longitude-deg");
+    static const SGPropertyNode *latitude
+       = fgGetNode("/position/latitude-deg");
+
+    SGPath zone( globals->get_fg_root() );
+    zone.append( "Timezone" );
+
+    SG_LOG(SG_GENERAL, SG_INFO, "updateLocal("
+          << longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
+          << ", "
+          << latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
+          << ", " << zone.str() << ")");
+    globals->get_time_params()->updateLocal( longitude->getDoubleValue()
+                                              * SGD_DEGREES_TO_RADIANS, 
+                                            latitude->getDoubleValue()
+                                              * SGD_DEGREES_TO_RADIANS,
+                                            zone.str() );
 }