aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data.rs6
-rw-r--r--src/prompt.rs5
2 files changed, 7 insertions, 4 deletions
diff --git a/src/data.rs b/src/data.rs
index d30068e..3e761c1 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -12,7 +12,7 @@ pub struct PromptData {
pub home: Option<std::path::PathBuf>,
pub user: Option<String>,
pub is_root: bool,
- pub time: chrono::DateTime<chrono::Local>,
+ pub time: time::OffsetDateTime,
pub power_info: power::PowerInfo,
pub vcs_info: Option<Box<dyn vcs::VcsInfo>>,
}
@@ -92,8 +92,8 @@ fn is_root() -> bool {
users::get_current_uid() == 0
}
-fn time() -> chrono::DateTime<chrono::Local> {
- chrono::Local::now()
+fn time() -> time::OffsetDateTime {
+ time::OffsetDateTime::now_local().unwrap()
}
fn power_info() -> power::PowerInfo {
diff --git a/src/prompt.rs b/src/prompt.rs
index 1ab60d2..6c95c0e 100644
--- a/src/prompt.rs
+++ b/src/prompt.rs
@@ -181,11 +181,14 @@ impl Prompt {
&self,
t: &mut dyn term::Terminal<Output = W>,
) {
+ let desc =
+ time::format_description::parse("[hour]:[minute]:[second]")
+ .unwrap();
self.print_host(t, "[");
self.colors.print(
t,
"default",
- &format!("{}", self.data.time.format("%H:%M:%S")),
+ &self.data.time.format(&desc).unwrap(),
);
self.print_host(t, "]");
}