Change time comparisons to exclusive

Closes #794
This commit is contained in:
Jacob Mischka 2021-11-17 02:55:12 -06:00 committed by David Peter
parent fe992706ae
commit f32060b0de
3 changed files with 5 additions and 4 deletions

View File

@ -26,6 +26,7 @@
- Support `--list-details` on more platforms (like BusyBox), see #783
- The filters `--owner`, `--size`, and `--changed-{within,before}` now apply to symbolic links
themselves, rather than the link target, except when `--follow` is specified; see #863
- Change time comparisons to be exclusive, see #794 (@jacobmischka)
## Changes

4
doc/fd.1 vendored
View File

@ -269,7 +269,7 @@ tebibytes
.TP
.BI "\-\-changed-within " date|duration
Filter results based on the file modification time.
Files with modification times greater than or equal to the argument will be returned.
Files with modification times greater than the argument will be returned.
The argument can be provided as a duration (\fI10h, 1d, 35min\fR) or as a specific point
in time in either full RFC3339 format with time zone, or as a date or datetime in the
local time zone (\fIYYYY-MM-DD\fR or \fIYYYY-MM-DD HH:MM:SS\fR).
@ -282,7 +282,7 @@ Examples:
.TP
.BI "\-\-changed-before " date|duration
Filter results based on the file modification time.
Files with modification times less than or equal to the argument will be returned.
Files with modification times less than the argument will be returned.
The argument can be provided as a duration (\fI10h, 1d, 35min\fR) or as a specific point
in time in either full RFC3339 format with time zone, or as a date or datetime in the
local time zone (\fIYYYY-MM-DD\fR or \fIYYYY-MM-DD HH:MM:SS\fR).

View File

@ -39,8 +39,8 @@ impl TimeFilter {
pub fn applies_to(&self, t: &SystemTime) -> bool {
match self {
TimeFilter::Before(limit) => t <= limit,
TimeFilter::After(limit) => t >= limit,
TimeFilter::Before(limit) => t < limit,
TimeFilter::After(limit) => t > limit,
}
}
}