Skip to content

Commit 7be77a6

Browse files
committed
timezones should now be fixed
1 parent b61641a commit 7be77a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ pub fn time_mod(
250250
time_format: &str,
251251
) -> Result<(), Box<dyn std::error::Error>> {
252252
if e.symlink_metadata()?.modified().is_ok() {
253-
let mtime = FileTime::from_last_modification_time(&e.symlink_metadata().unwrap());
254-
let d = NaiveDateTime::from_timestamp(mtime.seconds() as i64, 0);
253+
let timestamp = fs::symlink_metadata(e)?;
254+
let naive = NaiveDateTime::from_timestamp(FileTime::from_last_modification_time(&timestamp).seconds() as i64, 0);
255+
let datetime: DateTime<Local> = DateTime::from_utc(naive, *Local::now().offset());
255256
if !Cli::from_args().colors_on {
256257
print!("{}", color::Fg(color::LightRed));
257258
}
258-
let datetime = d;
259259
print!("{} ", datetime.format(time_format));
260260
}
261261
Ok(())

0 commit comments

Comments
 (0)