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
#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(unsafe_code)]
#![forbid(missing_docs)]
#![doc = include_str!("../README.md")]

mod calculator;
pub use calculator::*;

mod contants;
pub use contants::*;

mod datetime_formats;
pub use datetime_formats::*;

#[cfg(feature = "std")]
extern crate std;

#[cfg(feature = "std")]
#[cfg(test)]
mod sanity_tests {
    use crate::DateTime;

    #[test]
    fn test_utc() {
        let now = 1656603896;

        let mut datetime = DateTime::new();
        datetime.to_datetime(now);
        assert_eq!("2022-06-30 15:44:56 UTC", &format!("{}", datetime));
    }

    #[test]
    fn test_tai() {
        let now = 1656603896;

        let mut datetime = DateTime::new();
        datetime.to_taitime(now, 37);
        assert_eq!("2022-06-30 15:45:33 TAI", &format!("{}", datetime));
    }
}