1#![doc = include_str!("../README.md")]
3#![doc(issue_tracker_base_url = "https://github.com/swmff/rainbeam/issues/")]
4pub mod fs;
5pub mod hash;
6pub mod process;
7pub mod snow;
8pub mod ui;
9pub mod config;
10
11use std::time::{SystemTime, UNIX_EPOCH};
13use chrono::{TimeZone, Utc};
14
15pub fn unix_epoch_timestamp() -> u128 {
17 let right_now = SystemTime::now();
18 let time_since = right_now
19 .duration_since(UNIX_EPOCH)
20 .expect("Time travel is not allowed");
21
22 time_since.as_millis()
23}
24
25pub fn epoch_timestamp(year: i32) -> i64 {
27 let now = Utc::now().timestamp_millis();
28 let then = Utc
29 .with_ymd_and_hms(year, 1, 1, 0, 0, 0)
30 .unwrap()
31 .timestamp_millis();
32
33 now - then
34}