diff --git a/src/clock.rs b/src/clock.rs index 1a01783..901a875 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -108,3 +108,9 @@ pub fn get_utc_offset() -> i32 { pub fn get_utc_hour_name(hour: usize) -> &'static str { HOUR_NAMES[hour] } + +pub fn get_current_hour_name() -> &'static str { + let (utc_hour, _, _) = get_hms(&None, DayPart::UtcNow); + + get_utc_hour_name(utc_hour as usize) +} diff --git a/src/svg_clock.rs b/src/svg_clock.rs index ee43858..424bc77 100644 --- a/src/svg_clock.rs +++ b/src/svg_clock.rs @@ -14,7 +14,8 @@ use svg::{ use usvg::Tree; use crate::clock::{ - get_hms, get_moon_phase, get_seconds_since_midnight, get_utc_hour_name, get_utc_offset, DayPart, + get_current_hour_name, get_hms, get_moon_phase, get_seconds_since_midnight, get_utc_hour_name, + get_utc_offset, DayPart, }; use crate::config::Config; @@ -595,7 +596,7 @@ pub fn gen_svg( "y", (current_box_height / 5.0) + (current_hour_name_font_size / 2.0), ) - .add(TextNode::new(get_utc_hour_name(utc_hour as usize))); + .add(TextNode::new(get_current_hour_name())); let current_time_text = Text::new() .set("font-size", current_time_font_size)