From 39e3dc274464e7d2f663aa606a830611bae5f1db Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 5 Apr 2017 13:01:15 -0400 Subject: [PATCH] windows: add GetSystemTimePreciseAsFileTime https://msdn.microsoft.com/en-us/library/windows/desktop/hh706895(v=vs.85).aspx Change-Id: I6e6a6642c041fad046ae7db725a27e7e94bfbfba Reviewed-on: https://go-review.googlesource.com/39610 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- windows/syscall_windows.go | 1 + windows/zsyscall_windows.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go index 592d73e0..62c5ef3e 100644 --- a/windows/syscall_windows.go +++ b/windows/syscall_windows.go @@ -109,6 +109,7 @@ func NewCallbackCDecl(fn interface{}) uintptr //sys GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) = GetComputerNameExW //sys SetEndOfFile(handle Handle) (err error) //sys GetSystemTimeAsFileTime(time *Filetime) +//sys GetSystemTimePreciseAsFileTime(time *Filetime) //sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] //sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) //sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index f10ebbf2..1e27d813 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -93,6 +93,7 @@ var ( procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime") + procGetSystemTimePreciseAsFileTime = modkernel32.NewProc("GetSystemTimePreciseAsFileTime") procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation") procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") @@ -807,6 +808,11 @@ func GetSystemTimeAsFileTime(time *Filetime) { return } +func GetSystemTimePreciseAsFileTime(time *Filetime) { + syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) + return +} + func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) rc = uint32(r0)