Use full datetime when mocking the clock
Having the date and seconds show is really helpful for debugging
This commit is contained in:
parent
5cc577a012
commit
8e754d7c77
2 changed files with 8 additions and 2 deletions
|
|
@ -185,6 +185,7 @@ fn build_hud_content(state: SharedState) -> gtk4::Box {
|
|||
let clock_label = gtk4::Label::new(Some("--:--"));
|
||||
clock_label.add_css_class("clock-label");
|
||||
clock_box.append(&clock_label);
|
||||
let mut clock_format_full = false;
|
||||
|
||||
// Add mock indicator if mock time is active (debug builds only)
|
||||
#[cfg(debug_assertions)]
|
||||
|
|
@ -193,6 +194,7 @@ fn build_hud_content(state: SharedState) -> gtk4::Box {
|
|||
let mock_indicator = gtk4::Label::new(Some("(MOCK)"));
|
||||
mock_indicator.add_css_class("mock-time-indicator");
|
||||
clock_box.append(&mock_indicator);
|
||||
clock_format_full = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -369,7 +371,11 @@ fn build_hud_content(state: SharedState) -> gtk4::Box {
|
|||
glib::timeout_add_local(Duration::from_millis(500), move || {
|
||||
// Update wall clock display
|
||||
let current_time = shepherd_util::now();
|
||||
clock_label_clone.set_text(&shepherd_util::format_clock_time(¤t_time));
|
||||
if clock_format_full {
|
||||
clock_label_clone.set_text(&shepherd_util::format_datetime_full(¤t_time));
|
||||
} else {
|
||||
clock_label_clone.set_text(&shepherd_util::format_clock_time(¤t_time));
|
||||
}
|
||||
|
||||
// Update session state
|
||||
let session_state = state.session_state();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ pub fn format_clock_time(dt: &DateTime<Local>) -> String {
|
|||
|
||||
/// Format a DateTime for display with full date and time.
|
||||
pub fn format_datetime_full(dt: &DateTime<Local>) -> String {
|
||||
dt.format("%Y-%m-%d %H:%M:%S").to_string()
|
||||
dt.format("%Y-%m-%d %l:%M:%S %p").to_string()
|
||||
}
|
||||
|
||||
/// Represents a point in monotonic time for countdown enforcement.
|
||||
|
|
|
|||
Loading…
Reference in a new issue