Esempio n. 1
0
        internal static REG_TIMEZONE_INFO RegTimeZoneInfoFromExTimeZoneRuleGroup(ExTimeZoneRuleGroup group)
        {
            REG_TIMEZONE_INFO result          = default(REG_TIMEZONE_INFO);
            ExTimeZoneRule    exTimeZoneRule  = group.Rules[0];
            ExTimeZoneRule    exTimeZoneRule2 = (group.Rules.Count > 1) ? group.Rules[1] : null;

            if (exTimeZoneRule2 != null && exTimeZoneRule.Bias > exTimeZoneRule2.Bias)
            {
                ExTimeZoneRule exTimeZoneRule3 = exTimeZoneRule;
                exTimeZoneRule  = exTimeZoneRule2;
                exTimeZoneRule2 = exTimeZoneRule3;
            }
            result.Bias         = (int)(-(int)exTimeZoneRule.Bias.TotalMinutes);
            result.StandardBias = 0;
            if (exTimeZoneRule2 != null)
            {
                result.DaylightBias = (int)(exTimeZoneRule.Bias.TotalMinutes - exTimeZoneRule2.Bias.TotalMinutes);
                result.StandardDate = TimeZoneHelper.Win32SystemTimeFromRecurringTime(exTimeZoneRule2.ObservanceEnd);
                result.DaylightDate = TimeZoneHelper.Win32SystemTimeFromRecurringTime(exTimeZoneRule.ObservanceEnd);
            }
            return(result);
        }