1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-08-14
- * Changed: 2021-05-01
- *
- * */
- #ifndef LS_STD_DATE_HPP
- #define LS_STD_DATE_HPP
- #include <ls_std/base/Class.hpp>
- #include <ctime>
- namespace ls_std
- {
- class Date : public ls_std::Class
- {
- public:
- Date();
- ~Date() override = default;
- // arithmetic operators
- ls_std::Date &operator+(int _value);
- ls_std::Date &operator-(int _value);
- // additional functionality
- bool after(const ls_std::Date &_foreignDate) const;
- bool before(const ls_std::Date &_foreignDate) const;
- int getDay();
- int getHour();
- int getMinute();
- int getMonth();
- int getSecond();
- time_t getTime() const;
- int getYear();
- void setTime(time_t _timestamp);
- std::string toString();
- private:
- time_t timestamp{};
- tm *localTime{};
- void _init();
- };
- }
- #endif
|