1
0
Fork 0

Use a node for setting local time zone string

This commit is contained in:
James Turner 2021-06-10 14:32:30 +01:00
parent 691abf25c5
commit 14b7b5d3a1
2 changed files with 7 additions and 3 deletions

View file

@ -103,6 +103,7 @@ void TimeManager::init()
_warp->addChangeListener(this);
_maxFrameRate = fgGetNode("/sim/frame-rate-throttle-hz", true);
_localTimeStringNode = fgGetNode("/sim/time/local-time-string", true);
_localTimeZoneNode = fgGetNode("/sim/time/local-timezone", true);
_warpDelta = fgGetNode("/sim/time/warp-delta", true);
SGPath zone(globals->get_fg_root());
@ -624,7 +625,10 @@ void TimeManager::updateLocalTimeString()
_localTimeStringNode->setStringValue(buf);
}
fgSetString("/sim/time/local-timezone", _impl->get_description());
const char* zs = _localTimeZoneNode->getStringValue();
if (strcmp(zs, _impl->get_description()) != 0) {
_localTimeZoneNode->setStringValue(_impl->get_description());
}
}
void TimeManager::initTimeOffset()
@ -696,8 +700,7 @@ void TimeManager::setTimeOffset(const std::string& offset_type, long int offset)
_warp->setIntValue( orig_warp + warp );
}
SG_LOG( SG_GENERAL, SG_INFO, "After TimeManager::setTimeOffset(): warp = "
<< _warp->getIntValue() );
SG_LOG(SG_GENERAL, SG_INFO, "After TimeManager::setTimeOffset(): " << offset_type << ", warp = " << _warp->getIntValue());
}
double TimeManager::getSimSpeedUpFactor() const

View file

@ -106,6 +106,7 @@ private:
SGPropertyNode_ptr _frameWait;
SGPropertyNode_ptr _maxFrameRate;
SGPropertyNode_ptr _localTimeStringNode;
SGPropertyNode_ptr _localTimeZoneNode;
bool _lastClockFreeze = false;
bool _adjustWarpOnUnfreeze = false;