1use crate::Time;
2
3impl Time {
5 pub fn is_set(&self) -> bool {
7 *self != Self::default()
8 }
9}
10
11#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14#[allow(missing_docs)]
15pub enum Sign {
16 Plus,
17 Minus,
18}
19
20#[derive(Debug, Clone, Copy)]
22pub enum Format {
23 Custom(CustomFormat),
25 Unix,
27 Raw,
29}
30
31#[derive(Clone, Copy, Debug)]
33pub struct CustomFormat(pub(crate) &'static str);
34
35impl CustomFormat {
36 pub const fn new(format: &'static str) -> Self {
38 Self(format)
39 }
40}
41
42impl From<CustomFormat> for Format {
43 fn from(custom_format: CustomFormat) -> Format {
44 Format::Custom(custom_format)
45 }
46}
47
48pub mod format;
50mod init;
51mod write;
52
53mod sign {
54 use crate::time::Sign;
55
56 impl From<i32> for Sign {
57 fn from(v: i32) -> Self {
58 if v < 0 {
59 Sign::Minus
60 } else {
61 Sign::Plus
62 }
63 }
64 }
65}
66
67mod impls {
68 use crate::{time::Sign, Time};
69
70 impl Default for Time {
71 fn default() -> Self {
72 Time {
73 seconds: 0,
74 offset: 0,
75 sign: Sign::Plus,
76 }
77 }
78 }
79}