From d3bdc4e7bc909d3f7f4adb49d6b4330a592e3ac5 Mon Sep 17 00:00:00 2001 From: ehofman Date: Thu, 31 Mar 2005 17:00:27 +0000 Subject: [PATCH] Melchior FRANZ: FGAIMgr::GenerateSimpleAirportTraffic() tries to determine the airport's local hour from the /sim/time/gmt-time string, which fails, because at this time the property is still empty. That's why I don't get ATIS at LOWG (where it is *not* midnight right now. :-) -> use sg's get_cur_time() instead --- src/ATC/AIMgr.cxx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/ATC/AIMgr.cxx b/src/ATC/AIMgr.cxx index 2c118e0e1..c3682718f 100644 --- a/src/ATC/AIMgr.cxx +++ b/src/ATC/AIMgr.cxx @@ -353,13 +353,8 @@ void FGAIMgr::GenerateSimpleAirportTraffic(string ident, double min_dist) { bool cessna = true; // Get the time and only operate VFR in the (approximate) daytime. - //SGTime *t = globals->get_time_params(); - string time_str = fgGetString("sim/time/gmt-string"); - int loc_time = atoi((time_str.substr(0,3)).c_str()); - //cout << "gmt_time = " << loc_time << '\n'; - loc_time += (int)((aptpos.lon() / 360.0) * 24.0); - while(loc_time < 0) loc_time += 24; - while(loc_time > 24) loc_time -= 24; + time_t now = globals->get_time_params()->get_cur_time() + time_t(aptpos.lon() * 240.0); + int loc_time = gmtime(&now)->tm_hour; //cout << "loc_time = " << loc_time << '\n'; if(loc_time < 7 || loc_time > 19) return; -- 2.39.5