File: times_windows.go

package info (click to toggle)
golang-github-djherbis-times 1.0.1%2Bgit20170215.d25002f-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124 kB
  • sloc: makefile: 2
file content (36 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// http://golang.org/src/os/stat_windows.go

package times

import (
	"os"
	"syscall"
	"time"
)

// HasChangeTime and HasBirthTime are true if and only if
// the target OS supports them.
const (
	HasChangeTime = false
	HasBirthTime  = true
)

type timespec struct {
	atime
	mtime
	noctime
	btime
}

func getTimespec(fi os.FileInfo) Timespec {
	var t timespec
	stat := fi.Sys().(*syscall.Win32FileAttributeData)
	t.atime.v = time.Unix(0, stat.LastAccessTime.Nanoseconds())
	t.mtime.v = time.Unix(0, stat.LastWriteTime.Nanoseconds())
	t.btime.v = time.Unix(0, stat.CreationTime.Nanoseconds())
	return t
}