Fix padding in internet time

This commit is contained in:
Artemis Tosini 2023-12-14 01:21:13 +00:00
parent 8e968f13e6
commit f85d9b4910
Signed by: artemist
GPG key ID: ADFFE553DCBB831E

View file

@ -19,8 +19,10 @@ pub async fn internet_time_stream(config: InternetTimeConfig) {
let internet_time = seconds / 86.4; let internet_time = seconds / 86.4;
yield Ok(Block { yield Ok(Block {
full_text: format!( full_text: format!(
"@{time:03.prec$}", "@{time:0width$.prec$}",
time = internet_time, time = internet_time,
// 3 digits + and decimal point
width = config.precision as usize + 4,
prec = config.precision as usize prec = config.precision as usize
) )
.into_boxed_str(), .into_boxed_str(),