lox_time/lib.rs
1// SPDX-FileCopyrightText: 2023 Andrei Zisu <matzipan@gmail.com>
2// SPDX-FileCopyrightText: 2023 Angus Morrison <github@angus-morrison.com>
3// SPDX-FileCopyrightText: 2023 Helge Eichhorn <git@helgeeichhorn.de>
4//
5// SPDX-License-Identifier: MPL-2.0
6
7/*!
8 `lox-time` defines an API for working with instants in astronomical time scales.
9
10 # Overview
11
12 `lox_time` exposes:
13 - the marker trait [TimeScale] and zero-sized implementations representing the most common,
14 continuous astronomical time scales;
15 - the concrete type [Time] representing an instant in a [TimeScale];
16 - [Utc], the only discontinuous time representation supported by Lox;
17 - the [TryToScale] and [ToScale] traits, supporting transformations between pairs of time
18 scales;
19 - standard implementations of the most common time scale transformations.
20
21 # Continuous vs discontinuous timescales
22
23 Internally, Lox uses only continuous time scales (i.e. time scales without leap seconds). An
24 instance of [Time] represents an instant in time generic over a continuous [TimeScale].
25
26 [Utc] is used strictly as an I/O time format, which must be transformed into a continuous time
27 scale before use in the wider Lox ecosystem.
28
29 This separation minimises the complexity in working with leap seconds, confining these
30 transformations to the crate boundaries.
31*/
32
33#![warn(missing_docs)]
34
35/// Calendar date types (re-exported from `lox-core`).
36pub mod calendar_dates;
37/// Conversions between `lox-time` and `chrono` types.
38#[cfg(feature = "chrono")]
39pub mod chrono;
40/// Time deltas (re-exported from `lox-core`).
41pub mod deltas;
42/// Time intervals and set operations on them.
43pub mod intervals;
44/// Julian date types (re-exported from `lox-core`).
45pub mod julian_dates;
46/// Time scale offset computation.
47pub mod offsets;
48/// Sub-second precision types (re-exported from `lox-core`).
49pub mod subsecond;
50/// The [`Time`] type representing an instant in a continuous time scale.
51pub mod time;
52/// Time-of-day types (re-exported from `lox-core`).
53pub mod time_of_day;
54/// Astronomical time scale definitions.
55pub mod time_scales;
56/// Coordinated Universal Time (UTC) with leap-second support.
57pub mod utc;
58
59pub use time::{DynTime, Time, TimeBuilder, TimeError};