-void SGTime::updateLocal( double lon, double lat, const string& root ) {
- // sanity checking
- if ( lon < SGD_PI || lon > SGD_PI ) {
- // not within -180 ... 180
- lon = 0.0;
- }
- if ( lat < SGD_PI * 0.5 || lat > SGD_PI * 0.5 ) {
- // not within -90 ... 90
- lat = 0.0;
- }
- if ( lon != lon ) {
- // only true if lon == nan
- SG_LOG( SG_EVENT, SG_ALERT, " Detected lon == nan, resetting to 0.0" );
- lon = 0.0;
- }
- if ( lat != lat ) {
- // only true if lat == nan
- SG_LOG( SG_EVENT, SG_ALERT, " Detected lat == nan, resetting to 0.0" );
- lat = 0.0;
+void SGTime::updateLocal( const SGGeod& aLocation, const string& root ) {
+ SGGeod location(aLocation);
+ if (!aLocation.isValid()) {
+ location = SGGeod();