| 1 |
#ifndef DATE_HH |
| 2 |
#define DATE_HH |
| 3 |
|
| 4 |
#include <ctime> |
| 5 |
#include <limits> |
| 6 |
#include <span> |
| 7 |
#include <string> |
| 8 |
#include <string_view> |
| 9 |
|
| 10 |
namespace openmsx::Date { |
| 11 |
|
| 12 |
constexpr time_t INVALID_TIME_T = std::numeric_limits<time_t>::min(); |
| 13 |
|
| 14 |
|
| 15 |
constexpr time_t adjustTimeT(time_t time) { |
| 16 |
return (time == Date::INVALID_TIME_T) ? (Date::INVALID_TIME_T + 1) |
| 17 |
: time; |
| 18 |
} |
| 19 |
|
| 20 |
[[nodiscard]] time_t fromString(std::span<const char, 24> s); |
| 21 |
|
| 22 |
[[nodiscard]] std::string toString(time_t time); |
| 23 |
|
| 24 |
|
| 25 |
[[nodiscard]] std::string_view toString(time_t time, std::span<char, 24> buffer); |
| 26 |
|
| 27 |
} |
| 28 |
|
| 29 |
#endif |