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
//! # rstime
//!
//! A zero-dependency enhanced time library for Rust, built using the standard library.
//!
//! Provides date, time, datetime types with formatting, parsing, arithmetic,
//! Unix timestamp conversion, and clock functionality.
//!
//! ## Features
//!
//! - **Zero Dependencies**: Pure standard library implementation
//! - **Date & Time Types**: `Date`, `Time`, `DateTime` with validation
//! - **Duration & TimeDelta**: Positive and signed duration types with arithmetic
//! - **Custom Formatting**: `{YYYY}`, `{MM}`, `{DD}`, `{HH}`, `{mm}`, `{ss}` token system
//! - **Parsing**: Parse dates/times from strings with format patterns
//! - **ISO 8601**: Built-in ISO 8601 parsing and formatting
//! - **Weekday Calculation**: Zeller's formula for accurate weekday computation
//! - **Unix Timestamps**: Convert between `DateTime` and Unix timestamps
//! - **Clock**: System clock and monotonic clock for timing
//! - **12/24 Hour**: 12-hour clock conversion with AM/PM
//!
//! ## Quick Start
//!
//! ```rust
//! use rstime::{Date, Time, DateTime, Duration, TimeFormat};
//!
//! // Date handling
//! let date = Date::new(2026, 5, 10);
//! println!("{}", date); // 2026-05-10
//! println!("{}", date.weekday()); // Sunday
//!
//! // Time handling
//! let time = Time::new(14, 5, 9, 0);
//! println!("{}", time); // 14:05:09
//!
//! // Formatting
//! let dt = DateTime::new(date, time);
//! println!("{}", dt.format("{YYYY}年{MM}月{DD}日 {HH}:{mm}")); // 2026年05月10日 14:05
//!
//! // Clock
//! let now = DateTime::now();
//! println!("Now: {}", now);
//! ```
//!
//! ## Custom Format Tokens
//!
//! | Token | Description | Example |
//! |-------|-------------|---------|
//! | `{YYYY}` | 4-digit year | `2026` |
//! | `{MM}` | 2-digit month | `05` |
//! | `{DD}` | 2-digit day | `10` |
//! | `{HH}` | 24-hour | `14` |
//! | `{hh}` | 12-hour | `02` |
//! | `{mm}` | Minutes | `05` |
//! | `{ss}` | Seconds | `09` |
//! | `{SSS}` | Milliseconds | `037` |
//! | `{W}` | Short weekday | `Sun` |
//! | `{WW}` | Full weekday | `Sunday` |
//! | `{AMPM}` | Uppercase AM/PM | `PM` |
//! | `{ampm}` | Lowercase am/pm | `pm` |
pub use ;
pub use ;
pub use DateTime;
pub use ;
pub use ;
pub use TimeFormat;
pub use ;
pub use Time;