diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index f354967c..39c78c85 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -90,7 +90,8 @@ void SGTime::init( const SGGeod& location, const SGPath& root, time_t init_time SGTimeZone* nearestTz = static_tzContainer->getNearest(location); if (nearestTz) { - SGPath name = root / nearestTz->getDescription(); + description = nearestTz->getDescription(); + SGPath name = root / description; zonename = name.utf8Str(); SG_LOG( SG_EVENT, SG_DEBUG, "Using zonename = " << zonename ); } else { @@ -117,11 +118,6 @@ SGTime::SGTime() { } -SGTime::~SGTime() -{ -} - - // given Julian Date and Longitude (decimal degrees West) compute // Local Sidereal Time, in decimal hours. // @@ -231,9 +227,10 @@ void SGTime::updateLocal( const SGGeod& aLocation, const SGPath& root ) { time_t currGMT; time_t aircraftLocalTime; SGTimeZone* nearestTz = static_tzContainer->getNearest(location); - SGPath zone( root ); - zone.append ( nearestTz->getDescription() ); + description = nearestTz->getDescription(); + SGPath zone = root / description; zonename = zone.utf8Str(); + SG_LOG( SG_EVENT, SG_DEBUG, "Using zonename = " << zonename ); //Avoid troubles when zone.tab hasn't got the right line endings if (zonename[zonename.size()-1] == '\r') diff --git a/simgear/timing/sg_time.hxx b/simgear/timing/sg_time.hxx index df12d04e..d2d9368b 100644 --- a/simgear/timing/sg_time.hxx +++ b/simgear/timing/sg_time.hxx @@ -38,7 +38,7 @@ // forward decls class SGPath; class SGGeod; - + /** * A class to calculate and manage a variety of time parameters. * The SGTime class provides many real-world time values. It @@ -63,9 +63,12 @@ class SGTime { private: - // Points to the current local timezone name; + // Points to the current local timezone filename std::string zonename; + // Points to the current local timezone description + std::string description; + // Unix "calendar" time in seconds time_t cur_time; @@ -129,9 +132,9 @@ public: SGTime( const SGPath& root ); /** Destructor */ - ~SGTime(); + ~SGTime() = default; - /** + /** * Update the time related variables. * The update() method requires you to pass in your position and * an optional time offset in seconds. The offset (or warp) allows @@ -163,9 +166,12 @@ public: /** @return current system/unix time in seconds */ inline time_t get_cur_time() const { return cur_time; }; - /** @return time zone name for your current position*/ + /** @return time zone filename for your current position */ inline const char * get_zonename() const { return zonename.c_str(); } + /** @return time zone description for your current position */ + inline const char * get_description() const { return description.c_str(); } + /** @return GMT in a "brokent down" tm structure */ inline struct tm* getGmt()const { return (struct tm *)&m_gmt; }; @@ -200,7 +206,7 @@ public: * @param second current second * @return unix/system time in seconds */ -time_t sgTimeGetGMT(int year, int month, int day, +time_t sgTimeGetGMT(int year, int month, int day, int hour, int minute, int second); /**