openMSX
Date.hh
Go to the documentation of this file.
1#ifndef DATE_HH
2#define DATE_HH
3
4#include <ctime>
5#include <limits>
6#include <span>
7#include <string>
8
9namespace openmsx::Date {
10
11 constexpr time_t INVALID_TIME_T = std::numeric_limits<time_t>::min();
12
13 // Convert INVALID_TIME_T to a different (close) value.
14 constexpr time_t adjustTimeT(time_t time) {
15 return (time == Date::INVALID_TIME_T) ? (Date::INVALID_TIME_T + 1)
16 : time;
17 }
18
19 [[nodiscard]] time_t fromString(std::span<const char, 24> s);
20
21 [[nodiscard]] std::string toString(time_t time);
22
23} // namespace openmsx::Date
24
25#endif
constexpr time_t adjustTimeT(time_t time)
Definition Date.hh:14
std::string toString(time_t time)
Definition Date.cc:153
time_t fromString(std::span< const char, 24 > s)
Definition Date.cc:33
constexpr time_t INVALID_TIME_T
Definition Date.hh:11