public static DateTime GetLocalTime() { var time = new SystemDate(); Win32.GetSystemTime(ref time); var dt = time.ToDateTime(); return dt; }
public static SystemDate FromDateTime(DateTime dateTime) { var time = new SystemDate(); time._year = (ushort)dateTime.Year; time._month = (ushort)dateTime.Month; time._dayOfWeek = (ushort)dateTime.DayOfWeek; time._day = (ushort)dateTime.Day; time._hour = (ushort)dateTime.Hour; time._minute = (ushort)dateTime.Minute; time._mecond = (ushort)dateTime.Second; time._milliseconds = (ushort)dateTime.Millisecond; return(time); }
public static SystemDate FromDateTime(DateTime dateTime) { var time = new SystemDate(); time._year = (ushort)dateTime.Year; time._month = (ushort)dateTime.Month; time._dayOfWeek = (ushort)dateTime.DayOfWeek; time._day = (ushort)dateTime.Day; time._hour = (ushort)dateTime.Hour; time._minute = (ushort)dateTime.Minute; time._mecond = (ushort)dateTime.Second; time._milliseconds = (ushort)dateTime.Millisecond; return time; }
public static extern void GetLocalTime(ref SystemDate time);
public static extern bool SetLocalTime(ref SystemDate time);
public static extern bool SetSystemTime(ref SystemDate time);
public static extern void GetSystemTime(ref SystemDate time);
public static void SetSystemTime(DateTime dt) { var time = SystemDate.FromDateTime(dt); Win32.SetSystemTime(ref time); }