// Package mstypes implements representations of Microsoft types
package mstypes import ( ) /* FILETIME is a windows data structure. Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284%28v=vs.85%29.aspx It contains two parts that are 32bit integers: dwLowDateTime dwHighDateTime We need to combine these two into one 64bit integer. This gives the number of 100 nano second period from January 1, 1601, Coordinated Universal Time (UTC) */ const unixEpochDiff = 116444736000000000 // FileTime implements the Microsoft FILETIME type https://msdn.microsoft.com/en-us/library/cc230324.aspx type FileTime struct { LowDateTime uint32 HighDateTime uint32 } // Time return a golang Time type from the FileTime func ( FileTime) () time.Time { := (.MSEpoch() - unixEpochDiff) * 100 return time.Unix(0, int64()).UTC() } // MSEpoch returns the FileTime as a Microsoft epoch, the number of 100 nano second periods elapsed from January 1, 1601 UTC. func ( FileTime) () int64 { return (int64(.HighDateTime) << 32) + int64(.LowDateTime) } // Unix returns the FileTime as a Unix time, the number of seconds elapsed since January 1, 1970 UTC. func ( FileTime) () int64 { return (.MSEpoch() - unixEpochDiff) / 10000000 } // GetFileTime returns a FileTime type from the provided Golang Time type. func ( time.Time) FileTime { := .UnixNano() := ( / 100) + unixEpochDiff := >> 32 := - ( << 32) return FileTime{ LowDateTime: uint32(), HighDateTime: uint32(), } }