summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-01-10 18:20:04 +0200
committerLars Wirzenius <liw@liw.fi>2024-01-10 18:20:04 +0200
commit30e297a725594983ca3632f284f783f704915b3c (patch)
tree47256b72b7b542dcb6169a3a467c0a7cd1ca971d
parented2678e2bbcbecd88204f509aa376428758ce7a8 (diff)
downloadradicle-native-ci-30e297a725594983ca3632f284f783f704915b3c.tar.gz
feat: add a "last update" time stamp to the report page
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rw-r--r--src/report.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/report.rs b/src/report.rs
index 5ab7d4c..7b970df 100644
--- a/src/report.rs
+++ b/src/report.rs
@@ -5,6 +5,7 @@ use std::{
use html_page::{Document, Element, Tag};
use radicle_ci_broker::msg::RunResult;
+use time::{macros::format_description, OffsetDateTime};
use walkdir::WalkDir;
use crate::{logfile::LogFile, runinfo::RunInfo};
@@ -115,6 +116,14 @@ fn list_runs(repos: &[&str], run_infos: &[RunInfo]) -> Document {
doc.push_to_body(&list);
}
+ let fmt = format_description!(
+ "[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour]:[offset_minute]"
+ );
+ let now = OffsetDateTime::now_utc().format(fmt).expect("time format");
+
+ let timestamp = Element::new(Tag::Div).with_text(&format!("Last updated {}.", now));
+ doc.push_to_body(&timestamp);
+
doc
}