use std::time::SystemTime;
use chrono::{DateTime, Datelike, Local, Utc, format::SecondsFormat};
pub const DIR_PMBS: &'static str = ".pmbs";
pub const SYMLINK_LATEST: &'static str = "latest";
pub fn get_t() -> u64 {
let now = SystemTime::now();
now.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs()
}
fn get_datetime(t: u64) -> DateTime<Utc> {
DateTime::from_timestamp(t as i64, 0).unwrap()
}
pub fn get_year(t: u64) -> i32 {
get_datetime(t).year()
}
pub fn format_t(t: u64) -> String {
get_datetime(t).to_rfc3339_opts(SecondsFormat::Secs, true)
}
pub fn format_t_local(t: u64) -> String {
let local = get_datetime(t).with_timezone(&Local);
local.to_rfc3339_opts(SecondsFormat::Secs, false)
}