1 #ifndef _RAR_TIMEFN_
2 #define _RAR_TIMEFN_
3 
4 struct RarLocalTime
5 {
6   uint Year;
7   uint Month;
8   uint Day;
9   uint Hour;
10   uint Minute;
11   uint Second;
12   uint Reminder; // Part of time smaller than 1 second, represented in 100-nanosecond intervals.
13   uint wDay;
14   uint yDay;
15 };
16 
17 
18 class RarTime
19 {
20   private:
21     // Internal FILETIME like time representation in 100 nanoseconds
22     // since 01.01.1601.
23     uint64 itime;
24   public:
RarTime()25     RarTime() {Reset();}
26 #ifdef _WIN_ALL
RarTime(FILETIME & ft)27     RarTime(FILETIME &ft) {*this=ft;}
28     RarTime& operator =(FILETIME &ft);
29     void GetWin32(FILETIME *ft);
30 #endif
RarTime(time_t ut)31     RarTime(time_t ut) {*this=ut;}
32     RarTime& operator =(time_t ut);
33     time_t GetUnix();
operator ==(RarTime & rt)34     bool operator == (RarTime &rt) {return itime==rt.itime;}
operator !=(RarTime & rt)35     bool operator != (RarTime &rt) {return itime!=rt.itime;}
operator <(RarTime & rt)36     bool operator < (RarTime &rt)  {return itime<rt.itime;}
operator <=(RarTime & rt)37     bool operator <= (RarTime &rt) {return itime<rt.itime || itime==rt.itime;}
operator >(RarTime & rt)38     bool operator > (RarTime &rt)  {return itime>rt.itime;}
operator >=(RarTime & rt)39     bool operator >= (RarTime &rt) {return itime>rt.itime || itime==rt.itime;}
40     void GetLocal(RarLocalTime *lt);
41     void SetLocal(RarLocalTime *lt);
42     uint64 GetRaw();
43     void SetRaw(uint64 RawTime);
44     uint GetDos();
45     void SetDos(uint DosTime);
46     void GetText(wchar *DateStr,size_t MaxSize,bool FullYear,bool FullMS);
47     void SetIsoText(const wchar *TimeText);
48     void SetAgeText(const wchar *TimeText);
49     void SetCurrentTime();
Reset()50     void Reset() {itime=0;}
IsSet()51     bool IsSet() {return itime!=0;}
52 };
53 
54 const wchar *GetMonthName(int Month);
55 bool IsLeapYear(int Year);
56 
57 #endif
58