求Windows Mobile 设置系统时间方法。C#
如题
[最优解释]
public struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
[DllImport("coredll.dll")]
public static extern bool SetLocalTime(ref SYSTEMTIME Time);
var mm = new SYSTEMTIME()
{
wDay = (ushort)tt.Day,
wDayOfWeek = (ushort)tt.DayOfWeek,
wHour = (ushort)tt.Hour,
wMilliseconds = (ushort)tt.Millisecond,
wMinute = (ushort)tt.Minute,
wMonth = (ushort)tt.Month,
wSecond = (ushort)tt.Second,
wYear = (ushort)tt.Year
};
SetLocalTime(ref mm);