Debian Codegraph @

times_netbsd.go

raw symbols SCIP
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // http://golang.org/src/os/stat_netbsd.go
6
7 package times
8
9 import (
10 "os"
11 "syscall"
12 "time"
13 )
14
15 // HasChangeTime and HasBirthTime are true if and only if
16 // the target OS supports them.
17 const (
18 HasChangeTime = true
19 HasBirthTime = true
20 )
21
22 type timespec struct {
23 atime
24 mtime
25 ctime
26 btime
27 }
28
29 func timespecToTime(ts syscall.Timespec) time.Time {
30 return time.Unix(int64(ts.Sec), int64(ts.Nsec))
31 }
32
33 func getTimespec(fi os.FileInfo) (t timespec) {
34 stat := fi.Sys().(*syscall.Stat_t)
35 t.atime.v = timespecToTime(stat.Atimespec)
36 t.mtime.v = timespecToTime(stat.Mtimespec)
37 t.ctime.v = timespecToTime(stat.Ctimespec)
38 t.btime.v = timespecToTime(stat.Birthtimespec)
39 return t
40 }