You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
953 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASIC_TIMESTAMP_HEADER__
  2. #define __BASIC_TIMESTAMP_HEADER__
  3. #include <locale.h>
  4. #include <time.h>
  5. #define TIME_STAMP_PERCISION 1000 // 1000 = 1 second
  6. class basicTimeStamp
  7. {
  8. int m_iTimeZoneShift;
  9. time_t m_lTimeStamp;
  10. public:
  11. basicTimeStamp();
  12. basicTimeStamp(int LocalTimeZoneShift);
  13. ~basicTimeStamp();
  14. public:
  15. void setCurrent(void);
  16. void setUTS(time_t TS);
  17. void setLocal(time_t TS);
  18. time_t getUTS(void);
  19. time_t getLocal(void);
  20. int getYear(int TZ = 0);
  21. int getMonth(int TZ = 0);
  22. int getHour(int TZ = 0);
  23. int getMinutes(int TZ = 0);
  24. int getSeconds(int TZ = 0);
  25. basicTimeStamp & operator=(const basicTimeStamp & expr);
  26. basicTimeStamp & operator=(const int & expr);
  27. basicTimeStamp & operator-(const basicTimeStamp & expr);
  28. basicTimeStamp & operator+(const basicTimeStamp & expr);
  29. basicTimeStamp & operator-(const int & expr);
  30. basicTimeStamp & operator+(const int & expr);
  31. };
  32. #endif