diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a1b6a..f3b4e3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/doc/fd.1 b/doc/fd.1 index f60a7dd..51deaff 100644 --- a/doc/fd.1 +++ b/doc/fd.1 @@ -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). diff --git a/src/filter/time.rs b/src/filter/time.rs index 39979af..eb43c4b 100644 --- a/src/filter/time.rs +++ b/src/filter/time.rs @@ -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, } } }