2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Use .Equal() instead of == for time.Time

Closes #1238
This commit is contained in:
Alexander Neumann 2017-09-15 20:57:35 +02:00
parent 5b1e4df177
commit a60e751217
3 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ func sameModTime(fi1, fi2 os.FileInfo) bool {
} }
} }
return fi1.ModTime() == fi2.ModTime() return fi1.ModTime().Equal(fi2.ModTime())
} }
// directoriesEqualContents checks if both directories contain exactly the same // directoriesEqualContents checks if both directories contain exactly the same

View File

@ -134,7 +134,7 @@ func (arch *Archiver) reloadFileIfChanged(node *restic.Node, file fs.File) (*res
return nil, errors.Wrap(err, "restic.Stat") return nil, errors.Wrap(err, "restic.Stat")
} }
if fi.ModTime() == node.ModTime { if fi.ModTime().Equal(node.ModTime) {
return node, nil return node, nil
} }

View File

@ -503,7 +503,7 @@ func (node *Node) IsNewer(path string, fi os.FileInfo) bool {
extendedStat, ok := toStatT(fi.Sys()) extendedStat, ok := toStatT(fi.Sys())
if !ok { if !ok {
if node.ModTime != fi.ModTime() || if !node.ModTime.Equal(fi.ModTime()) ||
node.Size != size { node.Size != size {
debug.Log("node %v is newer: timestamp or size changed", path) debug.Log("node %v is newer: timestamp or size changed", path)
return true return true
@ -513,8 +513,8 @@ func (node *Node) IsNewer(path string, fi os.FileInfo) bool {
inode := extendedStat.ino() inode := extendedStat.ino()
if node.ModTime != fi.ModTime() || if !node.ModTime.Equal(fi.ModTime()) ||
node.ChangeTime != changeTime(extendedStat) || !node.ChangeTime.Equal(changeTime(extendedStat)) ||
node.Inode != uint64(inode) || node.Inode != uint64(inode) ||
node.Size != size { node.Size != size {
debug.Log("node %v is newer: timestamp, size or inode changed", path) debug.Log("node %v is newer: timestamp, size or inode changed", path)