monotonic_time/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![forbid(unsafe_code)]
3#![forbid(missing_docs)]
4#![doc = include_str!("../README.md")]
5
6mod calculator;
7pub use calculator::*;
8
9mod contants;
10pub use contants::*;
11
12mod datetime_formats;
13pub use datetime_formats::*;
14
15#[cfg(feature = "std")]
16extern crate std;
17
18#[cfg(feature = "std")]
19#[cfg(test)]
20mod sanity_tests {
21    use crate::DateTime;
22
23    #[test]
24    fn test_utc() {
25        let now = 1656603896;
26
27        let mut datetime = DateTime::new();
28        datetime.to_datetime(now);
29        assert_eq!("2022-06-30 15:44:56 UTC", &format!("{}", datetime));
30    }
31
32    #[test]
33    fn test_tai() {
34        let now = 1656603896;
35
36        let mut datetime = DateTime::new();
37        datetime.to_taitime(now, 37);
38        assert_eq!("2022-06-30 15:45:33 TAI", &format!("{}", datetime));
39    }
40}