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