Skip to content

Commit 7675ba0

Browse files
committed
added potentiall fix for time
1 parent a42c9de commit 7675ba0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "natls"
3-
version = "2.1.6"
3+
version = "2.1.7"
44
authors = ["Will Lane <[email protected]>"]
55
description = "nat - the 'ls' replacement you never knew you needed"
66
license = "MIT"

src/utils/file_times.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use chrono;
22
use filetime;
33

44
pub fn modified(file: std::path::PathBuf, format: String) -> String {
5-
if file.symlink_metadata().unwrap().modified().is_ok() {
5+
if file.symlink_metadata().unwrap().modified().is_ok() && filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap()).is_some(){
66
let naive = chrono::NaiveDateTime::from_timestamp(
77
filetime::FileTime::from_last_modification_time(&file.symlink_metadata().unwrap()).seconds()
88
as i64,
@@ -18,7 +18,7 @@ pub fn modified(file: std::path::PathBuf, format: String) -> String {
1818
}
1919

2020
pub fn created(file: std::path::PathBuf, format: String) -> String {
21-
if file.symlink_metadata().unwrap().created().is_ok() {
21+
if file.symlink_metadata().unwrap().created().is_ok() && filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap()).is_some() {
2222
let naive = chrono::NaiveDateTime::from_timestamp(
2323
filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap())
2424
.unwrap()

0 commit comments

Comments
 (0)