This PR introduces comprehensive support for C++ std::chrono types#2450
This PR introduces comprehensive support for C++ std::chrono types#2450FranciscoThiesen wants to merge 2 commits intomasterfrom
Conversation
|
@FranciscoThiesen Running tests. |
@FranciscoThiesen, how did you evaluate and compare efficiency? |
|
@toughengineer I have put this PR on hold because I am not certain that there is a widely accepted way to serialize these values. Currently, if one relies on C++26 reflection, one will get an implementation-specific serialization (which is not great), but I am not certain how we should fix this since the standard tells us nothing about serialization. |
|
@lemire, I was merely curious about the efficiency claim. I personally think ISO 8601 is the way to go, it's better than integers in many ways. E.g. what about clocks with different epochs, and what about |
|
@toughengineer Right. That makes a lot of sense (using ISO 8601). |
Summary
This PR introduces comprehensive support for C++ std::chrono types (durations and time_points) in simdjson's static reflection API,
enabling automatic JSON serialization and deserialization of temporal data.
Problem Solved
Previously, structs containing std::chrono::duration or std::chrono::time_point members could not be serialized/deserialized using
simdjson's static reflection features. This limitation forced users to manually convert temporal data or create custom serialization
logic.
Implementation Details
Key Design Decisions
Example Usage
Testing
All tests pass with reflection-enabled clang compiler. The implementation maintains exact millisecond precision through round-trip
serialization.