C#设置系统时间多加2小时?

时间:2015-07-02 18:55:52

标签: c# time set system

我使用这样的东西来改变系统日期和时间:

public struct SystemTime
        {
            public ushort Year;
            public ushort Month;
            public ushort DayOfWeek;
            public ushort Day;
            public ushort Hour;
            public ushort Minute;
            public ushort Second;
            public ushort Millisecond;
        };
        SystemTime updatedTime = new SystemTime();
        [DllImport("kernel32.dll", EntryPoint = "SetSystemTime", SetLastError = true)]
        public extern static bool Win32SetSystemTime(ref SystemTime sysTime);

                updatedTime.Year = (ushort)ushort.Parse(string);
                updatedTime.Month = (ushort)ushort.Parse(string);
                updatedTime.Day = (ushort)ushort.Parse(string);
                updatedTime.Hour = (ushort)ushort.Parse(string);
                updatedTime.Minute = (ushort)ushort.Parse(string);
                updatedTime.Second = (ushort)ushort.Parse(string);
                Win32SetSystemTime(ref updatedTime);

但是当日期发生变化时,系统时间会增加2个小时。为什么?

0 个答案:

没有答案