Use u64 for Epoch

This commit is contained in:
Ajeet D'Souza 2020-10-20 11:46:39 +05:30
parent 1e7976fb48
commit 314050f090
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ impl Dir {
const DAY: Epoch = 24 * HOUR;
const WEEK: Epoch = 7 * DAY;
let duration = now - self.last_accessed;
let duration = now.saturating_sub(self.last_accessed);
if duration < HOUR {
self.rank * 4.0
} else if duration < DAY {
@ -39,4 +39,4 @@ impl Dir {
}
pub type Rank = f64;
pub type Epoch = i64; // use a signed integer so subtraction can be performed on it
pub type Epoch = u64;

View File

@ -21,7 +21,7 @@ pub fn current_time() -> Result<Epoch> {
.context("system clock set to invalid time")?
.as_secs();
Ok(current_time as _)
Ok(current_time)
}
pub fn path_to_str<P: AsRef<Path>>(path: &P) -> Result<&str> {