X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Ftiming%2Fsg_time.hxx;h=e8155c1d1442c6470df2fd1319a44a1efba242a5;hb=eca2afb982a28e286c2f344c838efe152140a3be;hp=6d617db7a0a1a1dd5ab59153059c2fa3970e959b;hpb=fb054c7f8d8cafea58201cac4836f331d951a7a1;p=simgear.git diff --git a/simgear/timing/sg_time.hxx b/simgear/timing/sg_time.hxx index 6d617db7..e8155c1d 100644 --- a/simgear/timing/sg_time.hxx +++ b/simgear/timing/sg_time.hxx @@ -34,10 +34,6 @@ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #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 ); /**