Add std::chrono support
I've recently started using glaze (thanks, it's been nice so far) and I currently have some ad-hoc specializations for handling a few basic std::chrono types that need to be serialized in our code.
Seeing this issue I have two questions:
- Has there been any progress on this / is anyone working on it? (I want to avoid duplicating effort)
- Would you be interested in a PR even if it only handles a subset of the
std::chronotypes?
Regarding the latter: serializing durations is easy, but serializing time points is not -- except if we are dealing with a time point derived from a clock with a standardized epoch (like std::chrono::system_clock on C++20 or higher). I'd tend towards only supporting serialization of timepoints with well-defined clocks, rather than ending up in a situation where there's a non-portable default serialization of a time point using some arbitrary epoch.
No one is working this problem at the moment. So, I would be happy to merge in a pull request that implements an initial subset of support for std::chrono. I think your plan of attack makes sense.
I'll just note that whatever support is added should probably support the custom_read and custom_write meta booleans, so that whatever default is supplied can still be overwritten with a custom glz::meta: handling-ambiguous-partial-specialization