mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-03 15:47:38 -04:00
pkg/etw: Add support for time.Time
This change adds support for encoding time.Time values as FILETIME values in tracelogging events. FILETIME has slightly less precision than time.Time (100ns vs 1ns), but it is the closest availble match.
This commit is contained in:
@@ -3,6 +3,7 @@ package etw
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// eventData maintains a buffer which builds up the data for an ETW event. It
|
||||
@@ -63,3 +64,8 @@ func (ed *eventData) writeUint32(value uint32) {
|
||||
func (ed *eventData) writeUint64(value uint64) {
|
||||
binary.Write(&ed.buffer, binary.LittleEndian, value)
|
||||
}
|
||||
|
||||
// writeFiletime appends a FILETIME to the buffer.
|
||||
func (ed *eventData) writeFiletime(value syscall.Filetime) {
|
||||
binary.Write(&ed.buffer, binary.LittleEndian, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user