pax_global_header00006660000000000000000000000064143104630740014514gustar00rootroot0000000000000052 comment=38d2cc64edc354192a29735e4f31a578aea12769 windows-1.0.1/000077500000000000000000000000001431046307400132055ustar00rootroot00000000000000windows-1.0.1/.github/000077500000000000000000000000001431046307400145455ustar00rootroot00000000000000windows-1.0.1/.github/dependabot.yml000066400000000000000000000003151431046307400173740ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" - package-ecosystem: "gomod" directory: "/" schedule: interval: "daily" windows-1.0.1/.github/release.yml000066400000000000000000000005721431046307400167140ustar00rootroot00000000000000changelog: exclude: labels: - ignore-for-release categories: - title: Breaking Changes labels: - breaking-change - title: New Features labels: - enhancement - title: Bug Fixes labels: - bug - title: Documentation labels: - documentation - title: Other Changes labels: - "*" windows-1.0.1/.github/workflows/000077500000000000000000000000001431046307400166025ustar00rootroot00000000000000windows-1.0.1/.github/workflows/main.yml000066400000000000000000000026411431046307400202540ustar00rootroot00000000000000--- name: build on: push: tags: - v* branches: - main - master pull_request: permissions: contents: write pull-requests: read jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: go: - '1.17' - '1.18' steps: - name: Checkout uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: only-new-issues: true - name: Test run: go test -v -coverprofile=cover.out ./... - name: Send coverage uses: shogo82148/actions-goveralls@v1 with: path-to-profile: cover.out flag-name: Go-${{ matrix.go }} parallel: true finish: needs: build runs-on: ubuntu-latest steps: - uses: shogo82148/actions-goveralls@v1 with: parallel-finished: true - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v3 with: go-version: '1.18' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v3.1.0 with: version: latest args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} windows-1.0.1/.golangci.yaml000066400000000000000000000002771431046307400157400ustar00rootroot00000000000000--- linters: enable-all: true disable: - exhaustivestruct - exhaustruct - godox - goerr113 - gomnd - ireturn - nonamedreturns - varnamelen - wrapcheck windows-1.0.1/.goreleaser.yml000066400000000000000000000001271431046307400161360ustar00rootroot00000000000000--- builds: - skip: true release: prerelease: auto changelog: use: github-native windows-1.0.1/LICENSE000066400000000000000000000027501431046307400142160ustar00rootroot00000000000000BSD 3-Clause License Copyright (c) 2020, Matt Dainty All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. windows-1.0.1/README.md000066400000000000000000000022271431046307400144670ustar00rootroot00000000000000[![GitHub release](https://img.shields.io/github/v/release/bodgit/windows)](https://github.com/bodgit/windows/releases) [![Build Status](https://img.shields.io/github/workflow/status/bodgit/windows/build)](https://github.com/bodgit/windows/actions?query=workflow%3Abuild) [![Coverage Status](https://coveralls.io/repos/github/bodgit/windows/badge.svg?branch=main)](https://coveralls.io/github/bodgit/windows?branch=main) [![Go Report Card](https://goreportcard.com/badge/github.com/bodgit/windows)](https://goreportcard.com/report/github.com/bodgit/windows) [![GoDoc](https://godoc.org/github.com/bodgit/windows?status.svg)](https://godoc.org/github.com/bodgit/windows) ![Go version](https://img.shields.io/badge/Go-1.18-brightgreen.svg) ![Go version](https://img.shields.io/badge/Go-1.17-brightgreen.svg) windows ======= A collection of types native to Windows but are useful on non-Windows platforms. The `FILETIME`-equivalent type is the sole export which is a 1:1 copy of the type found in the `golang.org/x/sys/windows` package. That package only builds on `GOOS=windows` and this particular type gets used in other protocols and file types such as NTLMv2 and 7-zip. windows-1.0.1/filetime.go000066400000000000000000000026771431046307400153460ustar00rootroot00000000000000// Package windows is a collection of types native to Windows platforms but // are useful on non-Windows platforms. package windows // Taken from golang.org/x/sys/windows const offset int64 = 116444736000000000 // 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. type Filetime struct { LowDateTime uint32 HighDateTime uint32 } // Nanoseconds returns Filetime ft in nanoseconds // since Epoch (00:00:00 UTC, January 1, 1970). func (ft *Filetime) Nanoseconds() int64 { // 100-nanosecond intervals since January 1, 1601 nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) // change starting time to the Epoch (00:00:00 UTC, January 1, 1970) nsec -= offset // convert into nanoseconds nsec *= 100 return nsec } // NsecToFiletime converts nanoseconds to the equivalent Filetime type. func NsecToFiletime(nsec int64) (ft Filetime) { // convert into 100-nanosecond nsec /= 100 // change starting time to January 1, 1601 nsec += offset // split into high / low ft.LowDateTime = uint32(nsec & 0xffffffff) ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) return ft } windows-1.0.1/filetime_test.go000066400000000000000000000007171431046307400163760ustar00rootroot00000000000000package windows_test import ( "fmt" "time" "github.com/bodgit/windows" ) func ExampleNsecToFiletime() { ft := windows.NsecToFiletime(time.Date(2020, 7, 20, 17, 15, 10, 0, time.UTC).UnixNano()) fmt.Println(ft) // Output: {1384030976 30826169} } func ExampleFiletime_Nanoseconds() { //nolint:nosnakecase ft := windows.Filetime{ 1384030976, 30826169, } fmt.Println(time.Unix(0, ft.Nanoseconds()).UTC()) // Output: 2020-07-20 17:15:10 +0000 UTC } windows-1.0.1/go.mod000066400000000000000000000000521431046307400143100ustar00rootroot00000000000000module github.com/bodgit/windows go 1.13