Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate TimeZones to chrono via cfg; support relativistic time correction #12

Closed
ChristopherRabotin opened this issue Dec 30, 2017 · 2 comments
Assignees

Comments

@ChristopherRabotin
Copy link
Member

Currently, TimeZones aren't trivial to handle, as evident in tests/tz.rs. Even making an impl macro, as demonstrated here is not easy from that implementation.

It should be easy to convert a Utc to any other time zone object.

I guess that there needs to be some "generic date time container struct" which would house to computed date time with the computed offset, allowing for easy back and forth computations. Moreover, I don't think it's a great idea to require each TimeZone implementation to also implement fmt::Display : they will all be very similar so there needs to be a simple way to do this...

@ChristopherRabotin ChristopherRabotin self-assigned this Dec 30, 2017
@ChristopherRabotin ChristopherRabotin changed the title Drastically simplify TimeZone implementations Delegate TimeZones to chrono via cfg; support relativistic time correction Jan 2, 2018
@ChristopherRabotin
Copy link
Member Author

ChristopherRabotin commented Jan 2, 2018

Note: this comment supersedes the one above.

Rust's chrono has excellent time zone management and parsing. Rewriting all these features wouldn't serve a ton of purpose.

Support for leap seconds is especially useful for simulation environments where such high precision is important. Moreover, in several such situations, reference frames may be moving very fast compared to Earth (where TAI is based), and in the spirit of this library, it's important to show how such relativistic corrections can be applied. References for implementation include ESA's navipedia. Furthermore, if relativistic corrections are supported, it's trivial to support fixed offset timezones.

More complex formatting and parsing shall be handled through chrono. Chrono will be integrated as an optional dependency using an implementation similar to the one proposed here. The purpose of this is to allow for compatibility between chrono and hifitime without requiring it since it's likely that most implementations will not need all the features of chrono.

This library should also support clock instabilities, but that's for a bit later.

@ChristopherRabotin
Copy link
Member Author

ChristopherRabotin commented Jan 2, 2018

  • Enable date time initialization from different inertial reference frames which must be defined with respect to UTC. This will replace the TimeZone trait. (Name of the new trait is to be determined)
  • Provide implementation example of a simple frame moving at high speed away from Earth in a straight line. Show how time dilates.
  • Add a chrono_compat module as a cfg. This should allow easy computation of the duration between two chrono dates to include leap seconds.
  • Add clock stability computations on top of std::time::Duration to simulate clock drift. This might be done as a separate issue.

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

No branches or pull requests

1 participant