1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:14:47 -07:00

os: fix windows build

TBR=brainman
CC=golang-dev
https://golang.org/cl/5449048
This commit is contained in:
Russ Cox 2011-11-30 12:38:54 -05:00
parent ca6de008ba
commit 12eee9edbc
2 changed files with 12 additions and 3 deletions

View File

@ -6,5 +6,4 @@ package os
// Export for testing.
var TimespecToTime = timespecToTime
var Atime = atime

View File

@ -77,7 +77,11 @@ func basename(name string) string {
return name
}
func toFileInfo(name string, fa, sizehi, sizelo uint32, ctime, atime, wtime syscall.Filetime) FileInfo {
type winTimes struct {
atime, ctime syscall.Filetime
}
func toFileInfo(name string, fa, sizehi, sizelo uint32, ctime, atime, mtime syscall.Filetime) FileInfo {
fs := new(FileStat)
fs.mode = 0
if fa&syscall.FILE_ATTRIBUTE_DIRECTORY != 0 {
@ -90,10 +94,16 @@ func toFileInfo(name string, fa, sizehi, sizelo uint32, ctime, atime, wtime sysc
}
fs.size = int64(sizehi)<<32 + int64(sizelo)
fs.name = name
fs.modTime = time.Unix(0, wtime.Nanoseconds())
fs.modTime = time.Unix(0, mtime.Nanoseconds())
fs.Sys = &winTimes{atime, ctime}
return fs
}
func sameFile(fs1, fs2 *FileStat) bool {
return false
}
// For testing.
func atime(fi FileInfo) time.Time {
return time.Unix(0, fi.(*FileStat).Sys.(*winTimes).atime.Nanoseconds())
}