LEFT | RIGHT |
1 // Copyright 2013 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package os | 5 package os |
6 | |
7 // TODO(dfc) copied from FreeBSD, might be wrong | |
8 | 6 |
9 import ( | 7 import ( |
10 "syscall" | 8 "syscall" |
11 "time" | 9 "time" |
12 ) | 10 ) |
13 | 11 |
14 func sameFile(fs1, fs2 *fileStat) bool { | 12 func sameFile(fs1, fs2 *fileStat) bool { |
15 stat1 := fs1.sys.(*syscall.Stat_t) | 13 stat1 := fs1.sys.(*syscall.Stat_t) |
16 stat2 := fs2.sys.(*syscall.Stat_t) | 14 stat2 := fs2.sys.(*syscall.Stat_t) |
17 return stat1.Dev == stat2.Dev && stat1.Ino == stat2.Ino | 15 return stat1.Dev == stat2.Dev && stat1.Ino == stat2.Ino |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 52 } |
55 | 53 |
56 func timespecToTime(ts syscall.Timespec) time.Time { | 54 func timespecToTime(ts syscall.Timespec) time.Time { |
57 return time.Unix(int64(ts.Sec), int64(ts.Nsec)) | 55 return time.Unix(int64(ts.Sec), int64(ts.Nsec)) |
58 } | 56 } |
59 | 57 |
60 // For testing. | 58 // For testing. |
61 func atime(fi FileInfo) time.Time { | 59 func atime(fi FileInfo) time.Time { |
62 return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim) | 60 return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim) |
63 } | 61 } |
LEFT | RIGHT |