Skip to content

feat: add FFI-backed time scales and conversion traits for various ti…#3

Merged
VPRamon merged 3 commits intomainfrom
extend-ffi
Feb 28, 2026
Merged

feat: add FFI-backed time scales and conversion traits for various ti…#3
VPRamon merged 3 commits intomainfrom
extend-ffi

Conversation

@VPRamon
Copy link
Member

@VPRamon VPRamon commented Feb 28, 2026

This pull request significantly expands support for time scales in the tempoch library, introducing new types for a variety of astronomical and atomic time standards. It implements generic infrastructure for time scale traits, conversion, and arithmetic, and adds user-friendly type aliases for these new scales. Additionally, it introduces a UT1-specific method for computing ΔT (difference between Terrestrial Time and Universal Time).

The most important changes are:

New time scale types and aliases

  • Added new scale structs for TT, TAI, TDB, TCG, TCB, GPS, UT1, JDE, and Unix time in scales.hpp, each with documentation and intended storage format.
  • Introduced convenient type aliases in time.hpp for each new time scale, e.g., using TT = Time<TTScale>, using TAI = Time<TAIScale>, etc., making these types easier to use throughout the codebase.

Time scale traits and conversion infrastructure

  • Implemented a generic JDBackedScaleTraits template in scales.hpp to handle arithmetic and civil time conversion for all JD-backed scales, reducing code duplication and standardizing behavior.
  • Added explicit specializations of TimeScaleTraits for each new scale, using the generic JD-backed helper, and provided human-readable labels for each.
  • Expanded TimeConvertTraits to support direct and indirect (via JD) conversions between all supported time scales, including identity conversions and explicit specializations for JD↔{TT, TAI, TDB, TCG, TCB, GPS, UT1, JDE, UnixTime}.

UT1-specific functionality

  • Added a delta_t() method to Time<UTScale> (Universal Time), which computes ΔT (TT - UT1) in seconds, enabled only for UT1 time points.

Submodule update

  • Updated the tempoch submodule to the latest commit.

@VPRamon VPRamon self-assigned this Feb 28, 2026
@VPRamon VPRamon merged commit 6ad1755 into main Feb 28, 2026
3 checks passed
@VPRamon VPRamon deleted the extend-ffi branch February 28, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant