Ejemplo n.º 1
0
        public static String Bias()
        {
            Kernel32.TimeZoneInformation t = TimeZone();
            Kernel32.SystemTime          st;
            Kernel32.GetSystemTime(out st);
            int utc = (-(t.bias / 60 - (t.standardDate.Month > st.Month && st.Month < t.daylightDate.Month ? 1 : 0)));

            return("Смещение относительно UTC: " + (utc > 0 ? "+" : "") + utc.ToString() + " ч.");
        }
Ejemplo n.º 2
0
        public static String ShiftingTime(bool isWinter)
        {
            Kernel32.TimeZoneInformation t  = TimeZone();
            Kernel32.SystemTime          to = isWinter ? t.standardDate : t.daylightDate;
            Kernel32.SystemTime          st;
            Kernel32.GetSystemTime(out st);
            if (st.Month > to.Month)
            {
                st.Year++;
            }

            short days = 31;

            Kernel32.SystemTime t1 = new Kernel32.SystemTime(new DateTime(st.Year, to.Month, days));
            while (t1.DayOfWeek != to.DayOfWeek)
            {
                days--;
                t1 = new Kernel32.SystemTime(new DateTime(st.Year, to.Month, days, to.Hour, to.Minute, to.Second));
            }

            return("Переход на " + (isWinter ? "зимнее" : "летнее") + " время: " + FormatDate(t1) + " в " + FormatTime(t1));
        }