MSVC++ tweaks.
This commit is contained in:
parent
6a481eed36
commit
e5282caea5
@ -22,6 +22,10 @@
|
||||
// $Id$
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <errno.h> // 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 );
|
||||
|
||||
|
@ -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; };
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user