Skip to content

Commit 044c98d

Browse files
committed
Fixed mtime issue for OSX
1 parent 084eeaf commit 044c98d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

third_party/go9p/srv_file.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package go9p
66

77
import (
88
"log"
9+
"runtime"
910
"sync"
1011
"time"
1112
)
@@ -132,7 +133,11 @@ func (f *srvFile) Add(dir *srvFile, name string, uid User, gid Group, mode uint3
132133
f.Qid.Version = 0
133134
f.Qid.Path = qpath
134135
f.Mode = mode
135-
f.Atime = uint32(time.Now().Unix())
136+
if runtime.GOOS == "darwin" {
137+
f.Atime = uint32(time.Now().Truncate(time.Second).Unix())
138+
} else {
139+
f.Atime = uint32(time.Now().Unix())
140+
}
136141
f.Mtime = f.Atime
137142
f.Length = 0
138143
f.Name = name

third_party/go9p/ufs_darwin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (u *Ufs) Wstat(req *SrvReq) {
228228
//at = time.Time(0)//atime(st.Sys().(*syscall.Stat_t))
229229
}
230230
}
231-
e := os.Chtimes(fid.path, at, mt)
231+
e := os.Chtimes(fid.path, at.Truncate(time.Second), mt.Truncate(time.Second))
232232
if e != nil {
233233
req.RespondError(toError(e))
234234
return

0 commit comments

Comments
 (0)