#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
#[cfg(all(feature = "panic-handler", not(feature = "std"), not(test)))]
use core::panic::PanicInfo;
#[cfg(all(feature = "panic-handler", not(feature = "std"), not(test)))]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {
core::hint::spin_loop();
}
}
pub type Real = f64;
#[macro_export]
macro_rules! f {
($x:expr) => {
$x as $crate::Real
};
}
#[inline(always)]
pub const fn to_sec_f(attos: u128) -> Real {
f!(attos) / ATTOS_PER_SECF
}
#[inline(always)]
pub fn to_sec(attos: i128) -> i128 {
attos / ATTOS_PER_SEC_I128
}
#[inline(always)]
pub fn to_ms(attos: i128) -> i128 {
attos / ATTOS_PER_MS_I128
}
#[inline(always)]
pub fn to_us(attos: i128) -> i128 {
attos / ATTOS_PER_US_I128
}
#[inline(always)]
pub fn to_ns(attos: i128) -> i128 {
attos / ATTOS_PER_NS_I128
}
#[inline(always)]
pub fn to_ps(attos: i128) -> i128 {
attos / ATTOS_PER_PS_I128
}
#[inline(always)]
pub fn to_fs(attos: i128) -> i128 {
attos / ATTOS_PER_FS_I128
}
#[cfg(feature = "parse")]
mod alloc_parse;
#[cfg(feature = "sidereal")]
mod sidereal;
mod an_err;
mod ascii_str;
mod clock_model;
mod drift;
mod dt;
mod gregorian_time;
mod light_time;
mod parser;
mod position;
mod scale;
mod time_parts;
mod time_range;
pub mod constants;
pub mod error;
pub mod historical_sofa;
pub mod leap_seconds;
pub mod tzdb;
pub mod utils;
#[cfg(feature = "bop")]
pub mod bop;
#[cfg(feature = "parse")]
pub(crate) use alloc_parse::{
alloc_constants::*, date::*, date_classification::*, duration::*, lang_data::*, lang_map::*,
languages::en::*, parse_date::*, types::*,
};
pub(crate) use constants::*;
pub(crate) use utils::*;
#[cfg(feature = "parse")]
pub use alloc_parse::types::{DateOrder, DateParseMode, Lang, ParseCfg};
#[cfg(feature = "wire")]
pub use an_err::{WireErr, WireLocation};
#[cfg(feature = "sidereal")]
pub use sidereal::Sidereal;
pub use an_err::AnErr;
pub use ascii_str::{AsciiStr, AsciiStrError};
pub use clock_model::ClockModel;
pub use drift::{Drift, Spacetime};
pub use dt::Dt;
pub use dt::numbers_traits::{AttosTraits, TimeTraits};
pub use error::{DtErr, DtErrKind};
pub use gregorian_time::{GregorianTime, YmdHms};
pub use light_time::ObserverState;
pub use position::{Position, Velocity};
pub use scale::Scale;
pub use time_parts::{Meridiem, Offset, TimeParts, Weekday};
pub use time_range::{Every, TimeRange};