// SystemTime.h // // Revision Log // // Date Who SAR Notes // ========== === ======= ===================================== // 2001-10-29 mph Initial coding by Mark Henri of // MPH Software - markhenri@attbi.com // // #ifndef SYSTEMTIME_H__ #define SYSTEMTIME_H__ #include #include "iomanipx.h" #include #include #define MAX_SYSTEMTIME_BUFFER 24 class CSystemTime : public SYSTEMTIME { public: CSystemTime(); CSystemTime(int y, int m, int d, int h=0, int mn=0, int s=0, int ms=0); CSystemTime(CSystemTime&); CSystemTime(SYSTEMTIME&); CSystemTime(FILETIME&); CSystemTime(const char* s); // format: yyyy-mm-dd hh:mm:ss.mmm CSystemTime(const std::string& s); // format: yyyy-mm-dd hh:mm:ss.mmm CSystemTime& operator=(CSystemTime&); ~CSystemTime(); Initialize(); CSystemTime& operator = (const char*); CSystemTime& operator = (const std::string&); CSystemTime& operator = (SYSTEMTIME); CSystemTime& operator = (FILETIME); bool operator ==(CSystemTime&); void SetMDY(int m, int d, int y) { SetMonth(m); SetDay(d); SetYear(y); } void SetHMS(int h=0, int m=0, int s=0, int ms=0) { SetHour(h); SetMinute(m); SetSecond(s); SetMilliseconds(ms); } void SetYear(int n) { wYear = n; } int GetYear() { return wYear; } void SetMonth(int n) { wMonth = n; } int GetMonth() { return wMonth; } void SetDayOfWeek(int n) { wDayOfWeek = n; } int GetDayOfWeek() { return wDayOfWeek; } void SetDay(int n) { wDay = n; } int GetDay() { return wDay; } void SetHour(int n) { wHour = n; } int GetHour() { return wHour; } void SetMinute(int n) { wMinute = n; } int GetMinute() { return wMinute; } void SetSecond(int n) { wSecond = n; } int GetSecond() { return wSecond; } void SetMilliseconds(int n) { wMilliseconds = n; } int GetMilliseconds() { return wMilliseconds; } void ConvertToLocal(); //void ConvertToUTC(); rval_psz c_str(); friend ostream & operator<<(ostream & out, CSystemTime& o) { return out << padded_decimal<4>(o.GetYear()) << "-" << padded_decimal<2>(o.GetMonth()) << "-" << padded_decimal<2>(o.GetDay()) << " " << padded_decimal<2>(o.GetHour()) << ":" << padded_decimal<2>(o.GetMinute()) << ":" << padded_decimal<2>(o.GetSecond()) << "." << o.GetMilliseconds(); } // #ifdef _DEBUG // char ach[MAX_SYSTEMTIME_BUFFER]; // #endif private: CSystemTime& Parse(const char*); }; #endif // SYSTEMTIME_H__