return (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour==rhs.tm_hour && m_tm.tm_min==rhs.tm_min && m_tm.tm_sec==rhs.tm_sec) ? true : false;\r
}\r
\r
+const bool DateTime::operator<(const struct tm &rhs) const\r
+{\r
+ return (m_tm.tm_year<rhs.tm_year || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon<rhs.tm_mon) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday<rhs.tm_mday) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour<rhs.tm_hour) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour==rhs.tm_hour && m_tm.tm_min<rhs.tm_min) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour==rhs.tm_hour && m_tm.tm_min==rhs.tm_min && m_tm.tm_sec==rhs.tm_sec));\r
+}\r
+\r
void DateTime::Set(const int year, const int month, const int day, const int hour, const int minute, const int second)\r
{\r
m_tm.tm_year=year-1900;\r
m_tm=*localtime(&m_timet);\r
Normalize();\r
}\r
+\r
+const time_t DateTime::TimeGM(struct tm *gmtimein)\r
+{\r
+ //This looks good but I don't think will work when TZ isn't set (Windows)\r
+ //http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/timegm.3.html\r
+ \r
+ //This should work\r
+ //http://lists2.ais.fraunhofer.de/pipermail/emx/1999-September/000874.html\r
+\r
+ struct tm ttm;\r
+ time_t t, t2;\r
+\r
+ ttm = *gmtimein; /* make a local copy to fiddle with */\r
+ ttm.tm_isdst = 0; /* treat it as standard time */\r
+\r
+ t2 = t = mktime(&ttm); /* calculate the time as a local time */\r
+\r
+ ttm = *gmtime(&t2); /* now calculate the difference between */\r
+ ttm.tm_isdst = 0; /* gm and local time */\r
+ t2 = mktime(&ttm);\r
+\r
+ t += t - t2; /* and adjust our answer by that difference */\r
+ return t;\r
+}\r