DateTime.h 732 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef DATETIME_H
  2. #define DATETIME_H
  3. #include "date.h"
  4. #include "tz.h"
  5. #include <chrono>
  6. #include <string>
  7. namespace DateTime {
  8. struct DateTime
  9. {
  10. DateTime(int year, unsigned month, unsigned day) : year(year), month(month), day(day) {}
  11. int year;
  12. unsigned month;
  13. unsigned day;
  14. int hour = 0;
  15. int min = 0;
  16. int sec = 0;
  17. };
  18. std::chrono::system_clock::time_point DateTime_UTC_to_time_point(const DateTime& dt);
  19. std::chrono::system_clock::time_point DateTime_to_time_point(const DateTime& dt, const date::time_zone* tzone);
  20. int GetTimestamp();
  21. int GetUTCOffset();
  22. std::string GetTimeString();
  23. std::string GetTimeString(const std::chrono::system_clock::time_point& timePoint);
  24. } // namespace DateTime
  25. #endif // DATETIME_H