1use std::path::{Path, PathBuf};
2
3#[macro_use]
4pub mod macros;
5
6pub mod log;
7pub(crate) mod records;
8pub(crate) mod util;
9pub mod error;
10
11#[cfg(test)]
12mod test;
13
14type WpiTimestamp = u64;
16type EntryId = u32;
18type EntryName = String;
20type EntryType = String;
22type EntryMetadata = String;
24type LeBytes = Vec<u8>;
26type LeByte = u8;
28type EntryTypeMap = std::collections::HashMap<EntryId, EntryType>;
30type EntryIdToNameMap = bimap::BiMap::<EntryId, EntryName>;
32
33pub fn sec_from_micros(micros: WpiTimestamp) -> f64 {
34 micros as f64 / 1_000_000.0
35}
36
37pub fn now() -> WpiTimestamp {
38 let now = std::time::SystemTime::now();
39 let duration = now.duration_since(std::time::UNIX_EPOCH).unwrap();
40 duration.as_micros() as WpiTimestamp
41}
42
43pub fn absolute_path(rel_path: &Path) -> PathBuf {
44 let cwd = std::env::current_dir().unwrap();
46 cwd.join(rel_path)
48}