Debian Codegraph @

times_nacl.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 // https://golang.org/src/os/stat_nacljs.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 = false
20 )
21
22 type timespec struct {
23 atime
24 mtime
25 ctime
26 nobtime
27 }
28
29 func timespecToTime(sec, nsec int64) time.Time {
30 return time.Unix(sec, nsec)
31 }
32
33 func getTimespec(fi os.FileInfo) (t timespec) {
34 stat := fi.Sys().(*syscall.Stat_t)
35 t.atime.v = timespecToTime(stat.Atime, stat.AtimeNsec)
36 t.mtime.v = timespecToTime(stat.Mtime, stat.MtimeNsec)
37 t.ctime.v = timespecToTime(stat.Ctime, stat.CtimeNsec)
38 return t
39 }