Add time scale conversion functions and TempochScale enum#4
Merged
Conversation
added 2 commits
February 28, 2026 18:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive support for time scale conversions in the FFI layer, enabling conversions between Julian Date (TT) and a wide range of standard astronomical and civil time scales. It introduces both individual conversion functions and a generic dispatch mechanism, along with an enumeration for time scales to facilitate these operations from C/C++ code.
Key changes:
Time Scale Conversion Functions:
extern "C"for use in C/C++ environments. [1] [2]Generic Conversion Dispatch:
tempoch_jd_to_scaleandtempoch_scale_to_jdfunctions, which allow conversion between Julian Date and any supported time scale using a newTempochScaleenum as a parameter. This makes it easy to perform conversions when the target scale is not known at compile time. [1] [2]Time Scale Enumeration:
TempochScaleenum in both C and Rust, listing all supported time scales with explicit integer values for safe interop. This is used by the generic conversion functions for dispatch. [1] [2]ΔT Calculation:
tempoch_delta_t_seconds, an FFI function to compute ΔT (TT − UT1) in seconds for a given Julian Date, using the model fromtempoch-core. [1] [2]Internal Improvements:
These changes significantly enhance the flexibility and completeness of the time scale conversion API, making it much easier to interoperate with various time standards in cross-language contexts.