mirror of
https://github.com/Wojtek242/rwmstatus.git
synced 2024-11-21 15:15:25 +01:00
Use local time instead of a default TZ
This commit is contained in:
parent
1da8fdb0a3
commit
4408b3b54b
@ -12,8 +12,5 @@ pub const BATT_PATH: &'static str = "/sys/class/power_supply";
|
|||||||
/// Batteries to display.
|
/// Batteries to display.
|
||||||
pub const BATTS: [&'static str; 2] = ["BAT0", "BAT1"];
|
pub const BATTS: [&'static str; 2] = ["BAT0", "BAT1"];
|
||||||
|
|
||||||
/// Default Time zone.
|
|
||||||
pub const TZ_DEF: &str = "Europe/Berlin";
|
|
||||||
|
|
||||||
/// Additional time zones to display (short name, full name).
|
/// Additional time zones to display (short name, full name).
|
||||||
pub const TZS: [(char, &'static str); 2] = [('A', "America/Buenos_Aires"), ('U', "UTC")];
|
pub const TZS: [(char, &'static str); 2] = [('A', "America/Buenos_Aires"), ('U', "UTC")];
|
||||||
|
@ -152,7 +152,7 @@ pub fn get_times() -> String {
|
|||||||
tz_strs.push(format!("{}:{}", tz.0, get_tz_time(tz.1, "%H:%M")));
|
tz_strs.push(format!("{}:{}", tz.0, get_tz_time(tz.1, "%H:%M")));
|
||||||
}
|
}
|
||||||
|
|
||||||
tz_strs.push(get_tz_time(TZ_DEF, "KW %W %a %d %b %H:%M %Z %Y"));
|
tz_strs.push(get_local_time("KW %W %a %d %b %H:%M %Z %Y"));
|
||||||
|
|
||||||
tz_strs.join(" ")
|
tz_strs.join(" ")
|
||||||
}
|
}
|
||||||
@ -167,3 +167,8 @@ fn get_tz_time(tz_name: &str, fmt: &str) -> String {
|
|||||||
Err(_) => return format!(""),
|
Err(_) => return format!(""),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the local time.
|
||||||
|
fn get_local_time(fmt: &str) -> String {
|
||||||
|
format!("{}", Local::now().format(fmt))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user