commit
dec0742f87
|
@ -6,6 +6,7 @@ package go9p
|
|||
|
||||
import (
|
||||
"log"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
@ -132,7 +133,13 @@ func (f *srvFile) Add(dir *srvFile, name string, uid User, gid Group, mode uint3
|
|||
f.Qid.Version = 0
|
||||
f.Qid.Path = qpath
|
||||
f.Mode = mode
|
||||
f.Atime = uint32(time.Now().Unix())
|
||||
// macOS filesystem st_mtime values are only accurate to the second
|
||||
// without truncating, 9p will invent a changing fractional time #1375
|
||||
if runtime.GOOS == "darwin" {
|
||||
f.Atime = uint32(time.Now().Truncate(time.Second).Unix())
|
||||
} else {
|
||||
f.Atime = uint32(time.Now().Unix())
|
||||
}
|
||||
f.Mtime = f.Atime
|
||||
f.Length = 0
|
||||
f.Name = name
|
||||
|
|
|
@ -228,7 +228,9 @@ func (u *Ufs) Wstat(req *SrvReq) {
|
|||
//at = time.Time(0)//atime(st.Sys().(*syscall.Stat_t))
|
||||
}
|
||||
}
|
||||
e := os.Chtimes(fid.path, at, mt)
|
||||
// macOS filesystem st_mtime values are only accurate to the second
|
||||
// this ensures, 9p will only write mtime to the second #1375
|
||||
e := os.Chtimes(fid.path, at.Truncate(time.Second), mt.Truncate(time.Second))
|
||||
if e != nil {
|
||||
req.RespondError(toError(e))
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue