github.com/driusan/dgit@v0.0.0-20221118233547-f39f0c15edbb/git/file_mtime_plan9.go (about) 1 package git 2 3 import ( 4 "syscall" 5 ) 6 7 func (f File) MTime() (int64, error) { 8 stat, err := f.Stat() 9 if err != nil { 10 return 0, err 11 } 12 // Plan 9 only has 1 second precision and pads the nanoseconds 13 // with 0, so we pretend that the qid.Version is the number 14 // of nanoseconds. 15 base := int64(stat.ModTime().Unix()) << 32 16 sys := stat.Sys() 17 if internal, ok := sys.(*syscall.Dir); ok { 18 return base | int64(internal.Qid.Vers), nil 19 } 20 panic("Could not get QID.path for file") 21 22 }