returns true if the times are definitely different (by more than the modify window). returns false if equal, within modify window, or if either is unknown. considers precision per-Fs.
(ctx context.Context, a, b time.Time, fsA, fsB fs.Info)
| 196 | // returns false if equal, within modify window, or if either is unknown. |
| 197 | // considers precision per-Fs. |
| 198 | func timeDiffers(ctx context.Context, a, b time.Time, fsA, fsB fs.Info) bool { |
| 199 | modifyWindow := fs.GetModifyWindow(ctx, fsA, fsB) |
| 200 | if modifyWindow == fs.ModTimeNotSupported { |
| 201 | return false |
| 202 | } |
| 203 | if a.IsZero() || b.IsZero() { |
| 204 | fs.Logf(fsA, "Fs supports modtime, but modtime is missing") |
| 205 | return false |
| 206 | } |
| 207 | dt := b.Sub(a) |
| 208 | if dt < modifyWindow && dt > -modifyWindow { |
| 209 | fs.Debugf(a, "modification time the same (differ by %s, within tolerance %s)", dt, modifyWindow) |
| 210 | return false |
| 211 | } |
| 212 | |
| 213 | fs.Debugf(a, "Modification times differ by %s: %v, %v", dt, a, b) |
| 214 | return true |
| 215 | } |
| 216 | |
| 217 | func (b *bisyncRun) setFromCompareFlag(ctx context.Context) error { |
| 218 | if b.opt.CompareFlag == "" { |
no test coverage detected
searching dependent graphs…