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.

39 lines
1.0 KiB

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