Skip to content

Commit

Permalink
Version 1.0.21.beta
Browse files Browse the repository at this point in the history
Fixed issues where the wrong UTC time might be sent in some cases.
  • Loading branch information
albar965 committed Nov 2, 2020
1 parent 5e06d7d commit 60dc5c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
@@ -1,6 +1,10 @@
Numbers (#) refer to GitHub issues in project `littlenavmap`.
For example: #3 is `https://github.com/albar965/littlenavmap/issues/3`.

Version 1.0.21.beta

* Fixed issues where the wrong UTC time might be sent in some cases.

Version 1.0.20.beta

Notes:
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Expand Up @@ -92,7 +92,7 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
app->setOrganizationName("ABarthel");
app->setOrganizationDomain("littlenavmap.org");

app->setApplicationVersion("1.0.20.beta"); // VERSION_NUMBER - Little Xpconnect
app->setApplicationVersion("1.0.21.beta"); // VERSION_NUMBER - Little Xpconnect

// Initialize logging and force logfiles into the system or user temp directory
LoggingHandler::initializeForTemp(Settings::getOverloadedPath(":/littlexpconnect/resources/config/logging.cfg"));
Expand Down
17 changes: 4 additions & 13 deletions src/xpconnect.cpp
Expand Up @@ -250,19 +250,10 @@ bool XpConnect::fillSimConnectData(atools::fs::sc::SimConnectData& data, bool fe

// Build local time and use timezone offset from simulator
// X-Plane does not allow to set the year
QDate localDate = QDate::currentDate();
localDate.setDate(localDate.year(), 1, 1);
localDate = localDate.addDays(dr::localDateDays.valueInt());
int localTimeSec = static_cast<int>(dr::localTimeSec.valueFloat());
int zuluTimeSec = static_cast<int>(dr::zuluTimeSec.valueFloat());
int offsetSeconds = zuluTimeSec - localTimeSec;

QTime localTime = QTime::fromMSecsSinceStartOfDay(localTimeSec * 1000);
QDateTime localDateTime(localDate, localTime, Qt::OffsetFromUTC, -offsetSeconds);
userAircraft.localDateTime = localDateTime;

QTime zuluTime = QTime::fromMSecsSinceStartOfDay(zuluTimeSec * 1000);
userAircraft.zuluDateTime = QDateTime(localDate, zuluTime, Qt::UTC);
userAircraft.localDateTime = atools::correctDateLocal(dr::localDateDays.valueInt(),
atools::roundToInt(dr::localTimeSec.valueFloat()),
atools::roundToInt(dr::zuluTimeSec.valueFloat()));
userAircraft.zuluDateTime = userAircraft.localDateTime.toUTC();

// SimConnectAircraft
userAircraft.airplaneTitle = dr::airplaneTitle.valueString();
Expand Down

0 comments on commit 60dc5c4

Please sign in to comment.