]> git.mxchange.org Git - simgear.git/blobdiff - simgear/timing/sg_time.hxx
Various changes for MingWin32 support.
[simgear.git] / simgear / timing / sg_time.hxx
index 6d617db7a0a1a1dd5ab59153059c2fa3970e959b..e8155c1d1442c6470df2fd1319a44a1efba242a5 100644 (file)
 #endif                                   
 
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
 #ifdef SG_HAVE_STD_INCLUDES
@@ -82,7 +78,11 @@ private:
     time_t cur_time;
 
     // Break down of equivalent GMT time
+#if defined(_MSC_VER) || defined(__MINGW32__)
+    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;
@@ -166,7 +166,11 @@ public:
     inline char* get_zonename() const { return zonename; }
 
     /** @return GMT in a "brokent down" tm structure */
+#if defined(_MSC_VER) || defined(__MINGW32__)
+    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; };
@@ -227,12 +231,20 @@ inline time_t sgTimeGetGMT(struct tm* the_time) {
  * @return modified julian date */
 double sgTimeCalcMJD(int mn, double dy, int yr);
 
+/**
+ * \relates SGTime
+ * Given an optional offset from current time calculate the current
+ * modified julian date.
+ * @param warp number of seconds to offset from current time (0 if no offset)
+ * @return current modified Julian date (number of days elapsed
+ * since 1900 jan 0.5), mjd. */
+double sgTimeCurrentMJD( long int warp );
+
 /**
  * \relates SGTime
  * Given an mjd, calculate greenwich mean sidereal time, gst
  * @param mjd modified julian date
- * @return greenwich mean sidereal time (gst)
- */
+ * @return greenwich mean sidereal time (gst) */
 double sgTimeCalcGST( double mjd );
 
 /**