From 143285e2b7273aed41be2b269fa3482e7f9932f5 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 3 Mar 2023 15:45:56 +0000 Subject: [PATCH] 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/ --- vfs/file.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vfs/file.go b/vfs/file.go index aa2493a5f..5e5c74f97 100644 --- a/vfs/file.go +++ b/vfs/file.go @@ -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) }