MCPcopy
hub / github.com/rclone/rclone / timeDiffers

Function timeDiffers

cmd/bisync/compare.go:198–215  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

196// returns false if equal, within modify window, or if either is unknown.
197// considers precision per-Fs.
198func 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
217func (b *bisyncRun) setFromCompareFlag(ctx context.Context) error {
218 if b.opt.CompareFlag == "" {

Callers 4

fileInfoEqualMethod · 0.85
resyncTimeSizeEqualMethod · 0.85
findDeltasMethod · 0.85
applyDeltasMethod · 0.85

Calls 4

GetModifyWindowFunction · 0.92
LogfFunction · 0.92
DebugfFunction · 0.92
IsZeroMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…