Skip to content

Commit b9ecb45

Browse files
committed
fix/win: data types causing wrong current time computation
leading to now a/c displayed on Windows
1 parent b0498e4 commit b9ecb45

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Include/DataRefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ class DataRefs
10091009
int GetWeatherMaxMetarHeight_ft() const { return weatherMaxMETARheight_ft; }
10101010
float GetWeatherMaxMetarHeight_m() const { return float(weatherMaxMETARheight_ft * M_per_FT); }
10111011
int GetWeatherMaxMetarDist_nm() const { return weatherMaxMETARdist_nm; }
1012-
float GetWeatherMaxMetarDist_m() const { return weatherMaxMETARdist_nm * M_per_NM; }
1012+
float GetWeatherMaxMetarDist_m() const { return float(weatherMaxMETARdist_nm) * M_per_NM; }
10131013

10141014
// livetraffic/channel/...
10151015
void SetChannelEnabled (dataRefsLT ch, bool bEnable);

Src/DataRefs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,7 +2567,7 @@ double TimeIoGetUTCTimeDiff ()
25672567

25682568
// perform the HTTP get request
25692569
using namespace std::chrono;
2570-
const long startMs = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
2570+
const auto startMs = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
25712571
CURLcode cc = CURLE_OK;
25722572
if ( (cc=curl_easy_perform(pCurl)) != CURLE_OK )
25732573
{
@@ -2585,7 +2585,7 @@ double TimeIoGetUTCTimeDiff ()
25852585
LOG_MSG(logERR, "Could not get current time from TimeAPI.io: %d - %s", cc, curl_errtxt);
25862586
}
25872587
}
2588-
const long endMs = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
2588+
const auto endMs = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
25892589

25902590
if (cc == CURLE_OK)
25912591
{
@@ -2867,7 +2867,7 @@ bool DataRefs::WeatherFetchMETAR ()
28672867
{
28682868
// Trigger a weather update; this is an asynch operation
28692869
lastWeatherAttempt = GetMiscNetwTime();
2870-
return ::WeatherFetchUpdate(posUser, GetWeatherMaxMetarDist_nm());
2870+
return ::WeatherFetchUpdate(posUser, (float)GetWeatherMaxMetarDist_nm());
28712871
}
28722872
return false;
28732873
}

Src/LTWeather.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,15 +963,15 @@ class LTWeatherVisitor : public Visitor<bool> {
963963
const float alt_m = fieldAlt_m + dataRefs.GetWeatherMaxMetarHeight_m();
964964
// Standard wind speed (can be 0 for calm winds) and direction
965965
const float speed = wg.windSpeed().toUnit(Speed::Unit::METERS_PER_SECOND).value_or(0.0f);
966-
const float dir = wg.direction().degrees().value_or(0.0f);
966+
const float dir = (float)wg.direction().degrees().value_or(0.0f);
967967
w.FillUp(w.wind_altitude_msl_m, w.wind_speed_msc, // set wind speed up to preferred METAR height AGL
968968
alt_m, speed, true);
969969
w.FillUp(w.wind_altitude_msl_m, w.wind_direction_degt, // set wind direction up to preferred METAR height AGL
970970
alt_m, dir, false); // no interpolation...that can go wrong with headings
971971

972972
// Variable wind direction -> transform into +/- degrees as expected by XP
973-
const float begDir = wg.varSectorBegin().degrees().value_or(NAN);
974-
const float endDir = wg.varSectorEnd().degrees().value_or(NAN);
973+
const float begDir = (float)wg.varSectorBegin().degrees().value_or(NAN);
974+
const float endDir = (float)wg.varSectorEnd().degrees().value_or(NAN);
975975
const float halfDiff = !std::isnan(begDir) && !std::isnan(endDir) ?
976976
float(HeadingDiff(begDir, endDir) / 2.0) :
977977
0.0f;

docs/readme.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ <h3>v4.3.0</h3>
180180
<b>OpenGlider</b> planes with hidden id, that
181181
duplicate planes from other channels, are no longer drawn,
182182
avoiding duplicate planes in the sky.<br>
183-
If you disabled OpenSky just because of those duplicate planes
184-
consider enabling it again. Especially in Europe, OpenSky adds
183+
If you disabled OpenGlider just because of those duplicate planes
184+
consider enabling it again. Especially in Europe, OpenGlider adds
185185
to the immersion with its small planes, gliders, etc.
186186
</li>
187187
<li>Fixed <a href="https://github.com/TwinFan/LiveTraffic/issues/284">#284</a>: Allow a <i>Buffering Period</i> of more than

0 commit comments

Comments
 (0)