- Notifications
You must be signed in to change notification settings - Fork1.2k
This PR introduces comprehensive support for C++ std::chrono types#2450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lemire commentedSep 16, 2025
@FranciscoThiesen Running tests. |
toughengineer commentedSep 21, 2025
@FranciscoThiesen, how did you evaluate and compare efficiency? |
lemire commentedSep 21, 2025
@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. |
toughengineer commentedSep 21, 2025
@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 |
lemire commentedSep 23, 2025
@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.