#include <cstdio>
#include <cstdlib>
#include <ctime>
+#include <cstring>
#include <string>
#define DEGHR(x) ((x)/15.)
#define RADHR(x) DEGHR(x*SGD_RADIANS_TO_DEGREES)
+using std::string;
static const double MJD0 = 2415020.0;
static const double J2000 = 2451545.0 - MJD0;
SG_LOG( SG_EVENT, SG_INFO, "Reading timezone info from: "
<< zone.str() );
tzContainer = new SGTimeZoneContainer( zone.c_str() );
-
- SGGeoCoord location( SGD_RADIANS_TO_DEGREES * lat_rad, SGD_RADIANS_TO_DEGREES * lon_rad );
- SGGeoCoord* nearestTz = tzContainer->getNearest(location);
+ SGGeod location(SGGeod::fromRad(lon_rad, lat_rad));
+ SGTimeZone* nearestTz = tzContainer->getNearest(location);
SGPath name( root );
name.append( nearestTz->getDescription() );
SGTime::~SGTime()
{
- if ( tzContainer != NULL ) {
- SGTimeZoneContainer *tmp = tzContainer;
- tzContainer = NULL;
- delete tmp;
- }
+ delete tzContainer;
}
}
time_t currGMT;
time_t aircraftLocalTime;
- SGGeoCoord location( SGD_RADIANS_TO_DEGREES * lat_rad,
- SGD_RADIANS_TO_DEGREES * lon_rad );
- SGGeoCoord* nearestTz = tzContainer->getNearest(location);
+ SGGeod location(SGGeod::fromRad(lon_rad, lat_rad));
+ SGTimeZone* nearestTz = tzContainer->getNearest(location);
SGPath zone( root );
zone.append ( nearestTz->getDescription() );
zonename = zone.str();