diff --git a/localfs.go b/localfs.go index d9d4ff2..54f5306 100644 --- a/localfs.go +++ b/localfs.go @@ -145,7 +145,9 @@ func (fs *LocalFS) applyDirMetadata(n NodeDirectory) error { if err := fs.SetDirPermissions(n); err != nil { return err } - if n.MTime == time.Unix(0, 0) { + // Use Equal() rather than ==, which also compares the monotonic reading + // and the location and would miss an epoch mtime in a different location. + if n.MTime.Equal(time.Unix(0, 0)) { return nil } return r.Chtimes(n.Name, n.MTime, n.MTime) @@ -225,7 +227,7 @@ func (fs *LocalFS) CreateFile(n NodeFile) error { return err } - if n.MTime == time.Unix(0, 0) { + if n.MTime.Equal(time.Unix(0, 0)) { return nil } return r.Chtimes(n.Name, n.MTime, n.MTime) diff --git a/localfs_other.go b/localfs_other.go index 6ecf062..d3b8334 100644 --- a/localfs_other.go +++ b/localfs_other.go @@ -187,7 +187,7 @@ func (fs *LocalFS) CreateDevice(n NodeDevice) error { return fmt.Errorf("chmod %s: %w", n.Name, err) } } - if n.MTime == time.Unix(0, 0) { + if n.MTime.Equal(time.Unix(0, 0)) { return nil } return r.Chtimes(n.Name, n.MTime, n.MTime)