vfs: fix incorrect modtime on fs which don't support setting modtime

Before this change we were using the Precision literally to round the
precision of the mod times.

However fs.ModTimeNotSupported is 100y on backends which don't support
setting modtimes so rounding to 100y was producing very strange
results.

See: https://forum.rclone.org/t/saving-files-causes-wrong-modified-time-to-be-set-for-a-few-seconds-on-webdav-mount-with-bitrix24/36451/
This commit is contained in:
Nick Craig-Wood 2023-03-03 15:45:56 +00:00
parent 19e8c8d42a
commit 143285e2b7
1 changed files with 3 additions and 0 deletions

View File

@ -296,6 +296,9 @@ func (f *File) activeWriters() int {
// It should be called with the lock held
func (f *File) _roundModTime(modTime time.Time) time.Time {
precision := f.d.f.Precision()
if precision == fs.ModTimeNotSupported {
return modTime
}
return modTime.Truncate(precision)
}