anytime
Ergonomic astronomical rust timescales
anytime provides astronomical time scales and conversions with nanosecond
resolution. Time
stores an instant with a type-level scale, making changes of scale explicit.
Examples
Convert between scales
use ;
let utc = from_jd;
let tai: = utc.into;
Compare and difference
Values can be compared and differenced directly, even when they use different
scales. Subtraction returns a chrono::TimeDelta.
use ;
let earlier = from_jd;
let later: = from_jd.into;
let is_ordered = earlier < later;
let difference = later - earlier;
Format a Gregorian date
gregorian().to_string() preserves sub-second precision.
use ;
use NaiveDate;
let date = from_ymd_opt
.unwrap
.and_hms_nano_opt
.unwrap;
let date_string = from_gregorian
.gregorian
.to_string;
assert_eq!;