Open cyanskies opened 1 year ago
Could look at storing time as a std::tm? Will have to look at how other libs handle time.
std::tm
doesn't have members to store the time offset, but can store all the other data for a localtime and date. So we'd need to store both a std::tm
and an extra offset struct.
To convert our time types to std::chrono we can follow the following procedure:
std::tm
struct with our datastd::tm
to a std::time
with std::mktime
system_clock::time_point
with std::chrono::system_clock::from_time_t
The reverse could be done with:
to_time_t
gmtime
or localtime
We could also limit it to converting to time_t.
Should also look into using std::put_time
and std::strftime
to do most of the date formatting rather than hand rolling it in to_string_visitor
.
I'd like to add functions to convert between the datetime types in toml and std::chrono types.