Skip to content

Commit

Permalink
Keeping time intact while importing from main.mcf or METAR info
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Oct 7, 2024
1 parent 8657e54 commit 917dfb7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log

## 1.7.2

- 🎁 Keeping time intact while importing from `main.mcf` or METAR info


## 1.7.1

- 💊 Fixed time zone issues
Expand Down
14 changes: 8 additions & 6 deletions src/WettergeraetDesktop/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,22 @@ void Frame::fromObjectToInput()
{
this->icaoInput->SetValue(wxString(this->aerofly.nearestAirport));

/*
Keep date / time at current date / time to enable fetching of current weather
// Discard date from Aerofly date, instead set it to today...
this->utcDateValue = wxDateTime::Now().MakeUTC();

this->utcDateValue.SetYear(this->aerofly.year);
this->utcDateValue.SetMonth((wxDateTime::Month)(this->aerofly.month - 1));
this->utcDateValue.SetDay(this->aerofly.day);
// ...but keep the time
auto hour = floor(this->aerofly.hours);
this->utcDateValue.SetHour(hour);
this->utcDateValue.SetMinute(round((this->aerofly.hours - hour) * 60));
this->utcDateValue.SetSecond(0);

if (this->utcDateValue.IsLaterThan(wxDateTime::Now().MakeUTC())) {
// Substract one day if current datetime is in future
this->utcDateValue = this->utcDateValue.Subtract(wxDateSpan::Day());
}

this->utcTimeInput->SetValue(this->utcDateValue);
this->utcDateInput->SetValue(this->utcDateValue);
*/

this->windDirectionInput->SetValue(this->aerofly.windDirection);
this->windStrengthInput->SetValue(ceil(this->aerofly.getWindKts()));
Expand Down
4 changes: 2 additions & 2 deletions src/WettergeraetLib/AeroflyWeather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ double AeroflyWeather::getPressureHpa()
void AeroflyWeather::setFromMetar(const MetarParserSimple& metar)
{
this->setNearestAirport(metar.icao);
this->setDate(metar.observed.year, metar.observed.month, metar.observed.day);
this->setTime(metar.observed.hours, metar.observed.minutes);
//this->setDate(metar.observed.year, metar.observed.month, metar.observed.day);
//this->setTime(metar.observed.hours, metar.observed.minutes);
this->setWind(metar.wind.speedKts, metar.wind.degrees);
this->setTurbulence(metar.wind.speedKts, metar.wind.gustKts, metar.wind.degreesFrom, metar.wind.degreesTo, metar.conditions);
this->setThermalActivity(metar.temperatureCelsius);
Expand Down

0 comments on commit 917dfb7

Please sign in to comment.