windows

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2020 License: BSD-3-Clause Imports: 0 Imported by: 9

README

Build Status Coverage Status Go Report Card GoDoc

windows

A collection of types native to Windows but are useful on non-Windows platforms.

The FILETIME-comparable type is the sole export which is a 1:1 copy of the one from golang.org/x/sys/windows. However, that package isn't available for all platforms and this particular type gets used in other protocols and file types such as NTLMv2 and 7-Zip.

Documentation

Overview

Package windows is a collection of types native to Windows platforms but are useful on non-Windows platforms.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filetime

type Filetime struct {
	LowDateTime  uint32
	HighDateTime uint32
}

Filetime mirrors the Windows FILETIME structure which represents time as the number of 100-nanosecond intervals that have elapsed since 00:00:00 UTC, January 1, 1601. This code is taken from the golang.org/x/sys/windows package where it's not available for non-Windows platforms however various file formats and protocols pass this structure about so it's useful to have it available for interoperability purposes.

func NsecToFiletime

func NsecToFiletime(nsec int64) (ft Filetime)

NsecToFiletime converts nanoseconds to the equivalent Filetime type.

Example
ft := NsecToFiletime(time.Date(2020, 7, 20, 17, 15, 10, 0, time.UTC).UnixNano())

fmt.Println(ft)
Output:

{1384030976 30826169}

func (*Filetime) Nanoseconds

func (ft *Filetime) Nanoseconds() int64

Nanoseconds returns Filetime ft in nanoseconds since Epoch (00:00:00 UTC, January 1, 1970).

Example
ft := Filetime{
	1384030976,
	30826169,
}

fmt.Println(time.Unix(0, ft.Nanoseconds()).UTC())
Output:

2020-07-20 17:15:10 +0000 UTC

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL