timefn.hpp 1.2 KB

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