X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FTime%2Ffg_time.cxx;h=297c28f53e8cc7a207ae4316c79cdd3bc3d8bf10;hb=7a16ec4fb4e1663902f5022812291f01d7e37ee3;hp=9e93015cf898d5be4636432305d7906e0b577d45;hpb=10ceaa4ba0701cc7812d004e3f0e88f2e1ce9009;p=flightgear.git diff --git a/src/Time/fg_time.cxx b/src/Time/fg_time.cxx index 9e93015cf..297c28f53 100644 --- a/src/Time/fg_time.cxx +++ b/src/Time/fg_time.cxx @@ -51,6 +51,7 @@ #include #include +#include #include #include @@ -336,7 +337,7 @@ double FGTime::sidereal_course(double lng) // Update time variables such as gmt, julian date, and sidereal time -void FGTime::update( double lon ) { +void FGTime::update( double lon, double lat, double alt_m ) { double gst_precise, gst_course; FG_LOG( FG_EVENT, FG_DEBUG, "Updating time" ); @@ -393,6 +394,13 @@ void FGTime::update( double lon ) { gst = sidereal_course( 0.00 ) + gst_diff; lst = sidereal_course( -(lon * RAD_TO_DEG)) + gst_diff; } + + // Calculate local magnetic variation + double field[6]; + // cout << "alt_m = " << alt_m << endl; + magvar = SGMagVar( lat, lon, alt_m / 1000.0, jd, field ); + magdip = atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5)); + FG_LOG( FG_EVENT, FG_DEBUG, " Current lon=0.00 Sidereal Time = " << gst ); FG_LOG( FG_EVENT, FG_DEBUG,