feat: implement Time<S> class template and CivilTime struct; update t…#2
Merged
feat: implement Time<S> class template and CivilTime struct; update t…#2
Conversation
…ime-related headers and tests
added 4 commits
February 24, 2026 02:07
…and arithmetic operations
…arity chore: update subproject commits for qtty-cpp and tempoch
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 significantly refactors the time scale system in the
tempochC++ library to introduce a more extensible, trait-based approach for representing and converting between time scales. The main changes include replacing the old hardcoded time types and conversion logic with a genericTime<S>template, introducing scale tags and traits, and updating type aliases and documentation for clarity and extensibility.The most important changes are:
1. Introduction of Scale Tags and Traits
scales.hppheader that defines time scale tag types (JDScale,MJDScale,UTCScale) and theTimeScaleTraits/TimeConvertTraitstrait classes, enabling generic and extensible handling of time scales and conversions. This allows for easier addition of new time scales in the future.2. Refactoring of Type Aliases and Documentation
tempoch.hppto document and re-export the newTime<S>template and its aliases (JulianDate,MJD,CivilTime,UTC), and to include the newscales.hppand reorganized headers.3. Simplification of Time Type Definitions
JulianDate,MJD, andUTCintime.hppwith type aliases to the genericTime<S>template, and moved all implementation totime_base.hppandscales.hpp. This reduces code duplication and centralizes logic.4. Period and Traits Adjustments
Period<T>and its traits: clarified inperiod.hppthatTimeTraits<Time<S>>specializations are now provided automatically for all scale-based types, and provided a manual specialization forCivilTime. [1] [2]UTCPeriodto usePeriod<CivilTime>instead ofPeriod<UTC>, reflecting the new canonical civil time type.These changes modernize the codebase, improve extensibility for new time scales, and simplify the interface for users and maintainers.