mirror of
https://github.com/rclone/rclone.git
synced 2025-12-19 01:33:25 +00:00
Implement Precision interface in all filesystems
* drive: add mime type on upload * drive: correct info on upload to fix crash * local: measure time precision by making a local file and using Chtimes * swift: move snet parameter here * core: add -modify-window and compute the optimum one * core: use modify window when checking times
This commit is contained in:
10
fs.go
10
fs.go
@@ -32,6 +32,9 @@ type Fs interface {
|
||||
|
||||
// Remove the directory (container, bucket) if empty
|
||||
Rmdir() error
|
||||
|
||||
// Precision of the ModTimes in this Fs
|
||||
Precision() time.Duration
|
||||
}
|
||||
|
||||
// FIXME make f.Debugf...
|
||||
@@ -168,10 +171,11 @@ func Equal(src, dst FsObject) bool {
|
||||
// Size the same so check the mtime
|
||||
srcModTime := src.ModTime()
|
||||
dstModTime := dst.ModTime()
|
||||
if !dstModTime.Equal(srcModTime) {
|
||||
FsDebug(src, "Modification times differ: %v, %v", srcModTime, dstModTime)
|
||||
dt := dstModTime.Sub(srcModTime)
|
||||
if dt >= *modifyWindow || dt <= -*modifyWindow {
|
||||
FsDebug(src, "Modification times differ by %s: %v, %v", dt, srcModTime, dstModTime)
|
||||
} else {
|
||||
FsDebug(src, "Size and modification time the same")
|
||||
FsDebug(src, "Size and modification time differ by %s (within %s)", dt, *modifyWindow)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user