Code
/// <summary>
/// import WINDOWS DLL
/// </summary>
public class Win32
{
/// <summary>
/// 系统时间
/// 格林尼治时间
/// </summary>
/// <param name="sysTime">系统时间</param>
/// <returns>系统时间</returns>
[DllImport("Kernel32.dll")]
public static extern bool SetSystemTime(ref SystemTime sysTime);
/// <summary>
/// 本地时间
/// </summary>
/// <param name="sysTime">系统时间</param>
/// <returns>系统时间</returns>
[DllImport("Kernel32.dll")]
public static extern bool SetLocalTime(ref SystemTime sysTime);
/// <summary>
/// 获取系统时间
/// </summary>
/// <param name="sysTime">系统时间</param>
[DllImport("Kernel32.dll")]
public static extern void GetSystemTime(ref SystemTime sysTime);
/// <summary>
/// 获取本地时间
/// </summary>
/// <param name="sysTime">本地时间</param>
[DllImport("Kernel32.dll")]
public static extern void GetLocalTime(ref SystemTime sysTime);
/// <summary>
/// 系统时间
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SystemTime
{
/// <summary>
/// 年
/// </summary>
public ushort wYear;
/// <summary>
/// 月
/// </summary>
public ushort wMonth;
/// <summary>
/// 週
/// </summary>
public ushort wDayOfWeek;
/// <summary>
/// 日
/// </summary>
public ushort wDay;
/// <summary>
/// 時
/// </summary>
public ushort wHour;
/// <summary>
/// 分
/// </summary>
public ushort wMinute;
/// <summary>
/// 秒
/// </summary>
public ushort wSecond;
/// <summary>
/// 刻度
/// </summary>
public ushort wMiliseconds;
}
}
/// <summary>
/// import WINDOWS DLL
/// </summary>
public class Win32
{
/// <summary>
/// 系统时间
/// 格林尼治时间
/// </summary>
/// <param name="sysTime">系统时间</param>
/// <returns>系统时间</returns>
[DllImport("Kernel32.dll")]
public static extern bool SetSystemTime(ref SystemTime sysTime);
/// <summary>
/// 本地时间
/// </summary>
/// <param name="sysTime">系统时间</param>
/// <returns>系统时间</returns>
[DllImport("Kernel32.dll")]
public static extern bool SetLocalTime(ref SystemTime sysTime);
/// <summary>
/// 获取系统时间
/// </summary>
/// <param name="sysTime">系统时间</param>
[DllImport("Kernel32.dll")]
public static extern void GetSystemTime(ref SystemTime sysTime);
/// <summary>
/// 获取本地时间
/// </summary>
/// <param name="sysTime">本地时间</param>
[DllImport("Kernel32.dll")]
public static extern void GetLocalTime(ref SystemTime sysTime);
/// <summary>
/// 系统时间
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SystemTime
{
/// <summary>
/// 年
/// </summary>
public ushort wYear;
/// <summary>
/// 月
/// </summary>
public ushort wMonth;
/// <summary>
/// 週
/// </summary>
public ushort wDayOfWeek;
/// <summary>
/// 日
/// </summary>
public ushort wDay;
/// <summary>
/// 時
/// </summary>
public ushort wHour;
/// <summary>
/// 分
/// </summary>
public ushort wMinute;
/// <summary>
/// 秒
/// </summary>
public ushort wSecond;
/// <summary>
/// 刻度
/// </summary>
public ushort wMiliseconds;
}
}