2017-11-27 13:11:20 -05:00
|
|
|
|
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
|
|
|
|
|
|
|
|
|
|
namespace Vanara.PInvoke
|
|
|
|
|
{
|
|
|
|
|
public static partial class Kernel32
|
|
|
|
|
{
|
|
|
|
|
/// <summary>Convert a <see cref="SYSTEMTIME"/> value to a <see cref="FILETIME"/> value.</summary>
|
|
|
|
|
/// <param name="st">The <see cref="SYSTEMTIME"/> value.</param>
|
|
|
|
|
/// <returns>The converted <see cref="FILETIME"/> value.</returns>
|
|
|
|
|
public static FILETIME ToFILETIME(this SYSTEMTIME st)
|
|
|
|
|
{
|
2018-10-26 14:24:07 -04:00
|
|
|
|
SystemTimeToFileTime(st, out var ft);
|
2017-11-27 13:11:20 -05:00
|
|
|
|
return ft;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>Convert a <see cref="FILETIME"/> value to a <see cref="SYSTEMTIME"/> value.</summary>
|
2017-12-12 20:41:40 -05:00
|
|
|
|
/// <param name="ft">The <see cref="FILETIME"/> value.</param>
|
2017-11-27 13:11:20 -05:00
|
|
|
|
/// <returns>The converted <see cref="SYSTEMTIME"/> value.</returns>
|
|
|
|
|
public static SYSTEMTIME ToSYSTEMTIME(this FILETIME ft)
|
|
|
|
|
{
|
2018-10-26 14:24:07 -04:00
|
|
|
|
FileTimeToSystemTime(ft, out var st);
|
2017-11-27 13:11:20 -05:00
|
|
|
|
return st;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|