1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//! `time_compute` — a date/time computation library, with no external
//! dependency for its core (dates, times, durations). A few exceptions
//! are allowed: time zone handling (see [`offset`]), which relies on the
//! `tzdb`/`tz-rs` crates to read the IANA time zone database; and a
//! handful of optional, disabled-by-default crate features --
//! `serde`/`rkyv` (de)serialization (see the [`serde`] and [`rkyv`]
//! modules), `unstable-locales` (locale-aware formatting, see
//! [`Locale`]), `arbitrary` (fuzzing support), and `defmt` (compact
//! embedded-friendly formatting) -- each matching chrono's own optional
//! feature of the same name 1:1.
//!
//! Goal: offer an API as close as possible to `chrono`'s (same type names,
//! same methods, same behaviour), so that a project using `chrono` can
//! migrate by simply replacing `use chrono::...` with
//! `use time_compute::...`. The source code itself is entirely original.
//!
//! # Current status
//! - [`NaiveDate`]: a date without a time zone (proleptic Gregorian
//! calendar), with day/month arithmetic and ISO 8601 weeks.
//! - [`NaiveTime`]: a time of day, with nanosecond precision and leap
//! second support.
//! - [`NaiveDateTime`]: a date and time of day combined, without a time
//! zone.
//! - [`TimeDelta`] (also available as [`Duration`], its historical name in
//! `chrono`), [`Days`], [`Months`]: durations and calendar increments.
//! - [`Weekday`], [`Month`], [`Datelike`], [`Timelike`]: weekday, month,
//! and access to a date's or time's components.
//! - [`Utc`], [`Local`], [`FixedOffset`], [`DateTime<Tz>`](DateTime),
//! [`TimeZone`], [`Offset`], [`MappedLocalTime`]: time zones and
//! timezone-aware date/times.
//! - [`format`]: `strftime`-style formatting and parsing (`StrftimeItems`,
//! `Parsed`, RFC 2822/3339 helpers).
//! - [`WeekdaySet`]: a compact, `Copy` set of weekdays.
//! - [`round`]: rounding/truncating a date-time by a [`TimeDelta`] span or
//! by a number of subsecond digits ([`DurationRound`], [`SubsecRound`]).
//! - [`serde`] (crate feature `serde`) and [`rkyv`] (crate features
//! `rkyv`/`rkyv-16`/`rkyv-32`/`rkyv-64`/`rkyv-validation`): optional
//! (de)serialization support, disabled by default.
//! - [`Locale`] (crate feature `unstable-locales`): locale-aware formatting
//! via `NaiveDate::format_localized`/`DateTime::format_localized` (and
//! the `_with_items` variants), matching chrono's own
//! `unstable-locales` feature name and "unstable" semantics 1:1. Falls
//! back to English-only formatting when the feature is disabled.
//! - Crate feature `arbitrary`: `arbitrary::Arbitrary` support (for
//! fuzzing) on the same set of public types as chrono.
//! - Crate feature `defmt`: `defmt::Format` support (compact `Debug`-like
//! output for embedded/`no_std` targets) on the same set of public
//! types as chrono.
pub use DateTime;
pub use ;
pub use ;
pub use ;
pub use Locale;
// `JapaneseEra`: a `time_compute` extension -- not part of chrono, see
// `japanese_era.rs`.
pub use JapaneseEra;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// `WeekdaySetIter` is intentionally not re-exported: real chrono keeps
// `weekday_set` private and only exposes `WeekdaySet` itself, so the
// iterator returned by `WeekdaySet::iter` is unnameable outside the crate
// (callers just consume it via `for`/adapters). Matched here for parity.
pub use WeekdaySet;
/// Serialization/Deserialization with `serde`.
///
/// [`DateTime<Tz>`](DateTime) (de)serializes to/from an RFC 3339 string by
/// default. This module provides alternatives for (de)serializing as a
/// Unix timestamp instead (`ts_seconds`, `ts_milliseconds`,
/// `ts_microseconds`, `ts_nanoseconds`, and their `_option` variants),
/// intended for use with serde's `#[serde(with = "...")]` field attribute.
///
/// *Available on crate feature `serde` only.*
/// Zero-copy (de)serialization with `rkyv`.
///
/// This module re-exports the `Archived*` versions of this crate's types.
///
/// *Available on crate features `rkyv`, `rkyv-16`, `rkyv-32`, or
/// `rkyv-64` only.*