public TimeZoneImplementation(
     Moment effectiveTo,
     TimeSpan standardUtcOffset,
     AbstractDaylightSavingsAdjustment daylightSavingsAdjustment,
     TimeZoneAbbreviationFormat timeZoneAbbreviationFormat,
     Guid?id = null)
 {
     EffectiveTo                = effectiveTo;
     StandardUtcOffset          = standardUtcOffset;
     DaylightSavingsAdjustment  = daylightSavingsAdjustment;
     TimeZoneAbbreviationFormat = timeZoneAbbreviationFormat;
     Id = id ?? Guid.NewGuid();
 }
示例#2
0
        public TimeSpan GetDstOffset(Moment moment)
        {
            TimeZoneImplementation effectiveImplementation = GetEffectiveImplementation(moment);
            TimeSpan rawOffset = GetRawOffset(moment);

            // Guard: if the effectiveImplementation has no Daylight Savings Adjustment
            if (null == effectiveImplementation.DaylightSavingsAdjustment)
            {
                return(TimeSpan.Zero);
            }

            AbstractDaylightSavingsAdjustment daylightSavingsAdjustment =
                effectiveImplementation.DaylightSavingsAdjustment;
            TimeSpan dstOffset = daylightSavingsAdjustment.GetAdjustmentToStandardOffset(rawOffset, moment);

            return(dstOffset);
        }