Date.hpp 758 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-14
  6. * Changed: 2020-08-14
  7. *
  8. * */
  9. #ifndef DATE_HPP
  10. #define DATE_HPP
  11. #include "../base/Class.hpp"
  12. #include <ctime>
  13. namespace ls_std {
  14. class Date : public Class {
  15. public:
  16. Date();
  17. ~Date() = default;
  18. // arithmetic operators
  19. Date& operator+(int _value);
  20. // additional functionality
  21. bool after(Date foreignDate);
  22. bool before(Date foreignDate);
  23. time_t getTime();
  24. void setTime(time_t _timestamp);
  25. std::string toString();
  26. private:
  27. time_t timestamp {};
  28. tm* localTime {};
  29. void init();
  30. };
  31. }
  32. #endif