mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-22 21:05:16 +00:00
Use u64 for Epoch
This commit is contained in:
parent
1e7976fb48
commit
314050f090
@ -25,7 +25,7 @@ impl Dir {
|
|||||||
const DAY: Epoch = 24 * HOUR;
|
const DAY: Epoch = 24 * HOUR;
|
||||||
const WEEK: Epoch = 7 * DAY;
|
const WEEK: Epoch = 7 * DAY;
|
||||||
|
|
||||||
let duration = now - self.last_accessed;
|
let duration = now.saturating_sub(self.last_accessed);
|
||||||
if duration < HOUR {
|
if duration < HOUR {
|
||||||
self.rank * 4.0
|
self.rank * 4.0
|
||||||
} else if duration < DAY {
|
} else if duration < DAY {
|
||||||
@ -39,4 +39,4 @@ impl Dir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub type Rank = f64;
|
pub type Rank = f64;
|
||||||
pub type Epoch = i64; // use a signed integer so subtraction can be performed on it
|
pub type Epoch = u64;
|
||||||
|
@ -21,7 +21,7 @@ pub fn current_time() -> Result<Epoch> {
|
|||||||
.context("system clock set to invalid time")?
|
.context("system clock set to invalid time")?
|
||||||
.as_secs();
|
.as_secs();
|
||||||
|
|
||||||
Ok(current_time as _)
|
Ok(current_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn path_to_str<P: AsRef<Path>>(path: &P) -> Result<&str> {
|
pub fn path_to_str<P: AsRef<Path>>(path: &P) -> Result<&str> {
|
||||||
|
Loading…
Reference in New Issue
Block a user