1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-05 18:13:17 +00:00

implement ModTime via FUSE for remotes that support it (fixes #1197)

This commit is contained in:
Stefan Breunig
2017-03-23 20:41:21 +01:00
committed by Stefan Breunig
parent 216499d78b
commit 4dc030d081
5 changed files with 112 additions and 4 deletions

30
cmd/mount/file_test.go Normal file
View File

@@ -0,0 +1,30 @@
// +build linux darwin freebsd
package mount
import (
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestFileModTime(t *testing.T) {
run.skipIfNoFUSE(t)
run.createFile(t, "file", "123")
mtime := time.Date(2012, 11, 18, 17, 32, 31, 0, time.UTC)
err := os.Chtimes(run.path("file"), mtime, mtime)
require.NoError(t, err)
info, err := os.Stat(run.path("file"))
require.NoError(t, err)
// avoid errors because of timezone differences
assert.Equal(t, info.ModTime().Unix(), mtime.Unix())
run.rm(t, "file")
}