Desktop Functions: Smart Device Functions:
|
FileTime (Structures)
C# Definition:
[StructLayout(LayoutKind.Sequential)] VB.Net Definition:
<StructLayout(LayoutKind.Sequential)> _ Alternative Managed Definition:System.Runtime.InteropServices.FILETIME (obsolete), or System.Runtime.InteropServices.ComTypes.FILETIME in the .NET Framework 2.0. Notes:None. Sample Code:There is no reason not to use System.Runtime.InteropServices.ComTypes.FILETIME, but there still is a need for conversion to DateTime: C#
public static DateTime FiletimeToDateTime(FILETIME fileTime) { Actually, this is NOT working. The only solution I've found so far is using the API Kernel32.dll function FileTimeToSystemTime, then transforming from that into a regular DateTime. The reason it was not working, is the + operator between "((long) high) << 32" and "low". I changed this to the | operator. * Note that System.Runtime.InteropServices.FILETIME is now obsolete. Changed to use System.Runtime.InteropServices.ComTypes.FILETIME instead. This works for me in vb.net:
Private Shared Function ConvertFileTimeToDateTime(input As FILETIME) As DateTime
Completely without any error-prone bit shift operations: C#
[StructLayout(LayoutKind.Sequential)] Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed. |
|