Can export entire server configuration

This commit is contained in:
2025-06-17 21:17:25 +02:00
parent 1080ab5cb2
commit ab16bd7bcf
9 changed files with 369 additions and 3 deletions

@ -1,3 +1,4 @@
use chrono::Datelike;
use std::time::{SystemTime, UNIX_EPOCH};
/// Get the current time since epoch
@ -13,3 +14,15 @@ pub fn time() -> u64 {
.unwrap()
.as_secs()
}
/// Format given UNIX time in a simple format
pub fn format_date(time: i64) -> anyhow::Result<String> {
let date = chrono::DateTime::from_timestamp(time, 0).ok_or(anyhow::anyhow!("invalid date"))?;
Ok(format!(
"{:0>2}/{:0>2}/{}",
date.day(),
date.month(),
date.year()
))
}