From e5282caea5258e9169e1a1c6a36d5a0521866a95 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 15 May 2001 22:17:58 +0000 Subject: [PATCH] MSVC++ tweaks. --- simgear/timing/sg_time.cxx | 13 ++++++++++++- simgear/timing/sg_time.hxx | 8 ++++++++ simgear/timing/timezone.cxx | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index 2db16af8..5d6feb61 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -22,6 +22,10 @@ // $Id$ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include // for errno @@ -184,6 +188,9 @@ static double sidereal_course( time_t cur_time, struct tm *gmt, double lng ) // Update the time related variables void SGTime::update( double lon, double lat, long int warp ) { double gst_precise, gst_course; +#ifdef _MSC_VER + tm * gmt = &m_gmt; +#endif SG_LOG( SG_EVENT, SG_DEBUG, "Updating time" ); @@ -195,10 +202,14 @@ void SGTime::update( double lon, double lat, long int warp ) { << " warp = " << warp ); // get GMT break down for current time +#ifdef _MSC_VER + memcpy( gmt, gmtime(&cur_time), sizeof(tm) ); +#else gmt = gmtime(&cur_time); +#endif SG_LOG( SG_EVENT, SG_DEBUG, " Current GMT = " << gmt->tm_mon+1 << "/" - << gmt->tm_mday << "/" << gmt->tm_year << " " + << gmt->tm_mday << "/" << (1900 + gmt->tm_year) << " " << gmt->tm_hour << ":" << gmt->tm_min << ":" << gmt->tm_sec ); diff --git a/simgear/timing/sg_time.hxx b/simgear/timing/sg_time.hxx index 8997ffa0..e075cd96 100644 --- a/simgear/timing/sg_time.hxx +++ b/simgear/timing/sg_time.hxx @@ -78,7 +78,11 @@ private: time_t cur_time; // Break down of equivalent GMT time +#ifdef _MSC_VER + struct tm m_gmt; // copy of system gmtime(&time_t) structure +#else struct tm *gmt; +#endif // offset of local time relative to GMT time_t local_offset; @@ -162,7 +166,11 @@ public: inline char* get_zonename() const { return zonename; } /** @return GMT in a "brokent down" tm structure */ +#ifdef _MSC_VER + inline struct tm* getGmt()const { return (struct tm *)&m_gmt; }; +#else inline struct tm* getGmt()const { return gmt; }; +#endif /** @return julian date */ inline double getJD() const { return jd; }; diff --git a/simgear/timing/timezone.cxx b/simgear/timing/timezone.cxx index 9bdb7a2f..f0d91404 100644 --- a/simgear/timing/timezone.cxx +++ b/simgear/timing/timezone.cxx @@ -132,11 +132,16 @@ TimezoneContainer::TimezoneContainer(const char *filename) if (feof(infile)) { break; } +#ifdef _MSC_VER + if( buffer[0] == '#' ) + continue; +#else for (int i = 0; i < 256; i++) { if (buffer[i] == '#') { buffer[i] = 0; } } +#endif if (buffer[0]) { data.push_back(new Timezone(buffer)); } -- 2.39.2