public static TimeZoneInfo.AdjustmentRule GetStaticAdjustmentRule(RegistryTimeZoneInformation information)
 {
     if (RegistryTimeZoneUtils.IsDaylightSavingsEnabled())
     {
         return(CreateStaticAdjustmentRule(information.Bias, information.StandardBias, information.DaylightBias, information.StandardDate, information.DaylightDate));
     }
     else
     {
         // We cant have an AdjustmentRule if there is no DST
         return(null);
     }
 }
        /// <summary>
        /// This will return the static timezone adjustment rule the the OS uses.
        /// We assume that the static rule is used by one of the dynamic adjustment rules.
        /// </summary>
        public static TimeZoneInfo.AdjustmentRule FindSystemStaticAdjustmentRule(string keyName)
        {
            RegistryTimeZoneInformation information = RegistryTimeZoneUtils.GetStaticTimeZoneInformation(keyName);

            if (information == null)
            {
                throw new TimeZoneNotFoundException();
            }
            else
            {
                return(GetStaticAdjustmentRule(information));
            }
        }
        public static TimeZoneInfo GetSystemStaticTimeZone(string keyName)
        {
            RegistryTimeZoneInformation information = RegistryTimeZoneUtils.GetStaticTimeZoneInformation(keyName);

            TimeZoneInfo.AdjustmentRule rule = AdjustmentRuleUtils.GetStaticAdjustmentRule(information);
            string displayName;
            string standardDisplayName;
            string daylightDisplayName;

            displayName = RegistryTimeZoneUtils.GetDisplayName(keyName, out standardDisplayName, out daylightDisplayName);

            TimeSpan baseUtcOffset = new TimeSpan(0, -(information.Bias + information.StandardBias), 0);

            if (rule == null)
            {
                // null will only be returned if there is no daylight saving
                return(TimeZoneInfo.CreateCustomTimeZone(keyName, baseUtcOffset, displayName, standardDisplayName));
            }
            else
            {
                return(TimeZoneInfo.CreateCustomTimeZone(keyName, baseUtcOffset, displayName, standardDisplayName, daylightDisplayName, new TimeZoneInfo.AdjustmentRule[] { rule }));
            }
        }