Skip to content

Hifitime version 4.0.0: A Leap Forward in Time Management

Months of meticulous development and rigorous testing culminate in version 4.0.0 of Hifitime, a reference time management library for engineering and scientific applications.

Hifitime inherently supports leap seconds, time scales, Julian dates, and lots more, while guaranteeing exactly one nanosecond accuracy for over 65 thousand years. Hifitime plans lunar missions via ANISE, flies onboard various spacecraft, coordinates satellite communications, and is used in exciting research on global navigation satellite systems like GPS and Galileo.

For those eager to dive into the technical details, you can find the Rust user guide here and the Python user guide here.

Github

Key improvements

One of the most significant changes in version 4.0.0 is how Epochs handle time scales. Epochs now retain their original time scales, simplifying conversions and ensuring that computations remain accurate without introducing single-digit nanosecond rounding errors. Special thanks to Guillaume for his dedicated work on this enhancement.

This change implies that the duration between two epochs is consistent with their time scale if both are in the same time scale. For example, the time difference over a leap second when both epochs are in UTC is a single second, instead of two seconds in version 3. The behavior from version 3 now requires converting one or both epochs to a leap-second free time scale.

Another notable change is in the serialization of durations. Previously, a 200-nanosecond duration was represented in JSON as {"centuries": 0, "nanoseconds": 200}. Now, it is serialized directly as 200 ns, its representation in the Système International (SI). The largest unit in this new serialization format is days, so a duration of 1.23456789 centuries will be serialized as 45092 days 14 h 12 min 44 s 546 ms 399 μs 744 ns.

Epochs are now nominally printed in their Gregorian representation in their respective time scale, whereas the debug printing (or __repr__ in Python) will print them in UTC.

Python users may now use todatetime and fromdatetime to convert a Hifitime epoch into a Python datetime object.

Bug fixes

In previous versions, representing date times in the Gregorian format required complex calculations that were prone to errors, especially for dates before 1800. Version 4 simplifies these computations, eliminating known bugs. Hifitime uses a consistent Gregorian calendar representation, avoiding any discrepancies from historical calendar transitions.

License change

Following an open period for community feedback that began earlier this year, Hifitime version 4 is now licensed under the Mozilla Public License version 2.0. This change reflects the project's commitment to open-source principles and community collaboration.

What's next for Hifitime?

Looking ahead, Version 4.1 is set to introduce several new time scales, including the recently drafted Lunar Coordinate Time. Special thanks to J-M for providing the specifications that make this possible.

Hifitime version 5 is also on the horizon. This upcoming release aims to enhance precision by extending the representation of durations from nanoseconds down to zeptoseconds, or twelve orders of magnitude smaller than one nanosecond. Additionally, plans to streamline the library by removing cumbersome initializers have been deferred to this major release.

With these updates, Hifitime continues to set the standard for precision time management in scientific and engineering contexts. Whether you're navigating lunar missions or synchronizing satellite communications, Hifitime version 4.0.0 offers unparalleled accuracy and reliability.

blog-post-image