private ZoneInterval GetIntervalAfterGap(LocalInstant localInstant) { Instant guess = new Instant(localInstant.Ticks); ZoneInterval guessInterval = GetZoneInterval(guess); // If the local interval occurs before the zone interval we're looking at starts, // it's the one we're looking for. Otherwise, we need to find the next interval. if (localInstant.Minus(guessInterval.WallOffset) < guessInterval.Start) { return(guessInterval); } else { return(GetZoneInterval(guessInterval.End)); } }
private ZoneInterval GetIntervalAfterGap(LocalInstant localInstant) { Instant guess = localInstant.MinusZeroOffset(); ZoneInterval guessInterval = GetZoneInterval(guess); // If the local interval occurs before the zone interval we're looking at starts, // it's the one we're looking for. Otherwise, we need to find the next interval. if (localInstant.Minus(guessInterval.WallOffset) < guessInterval.RawStart) { return(guessInterval); } else { // Will definitely be valid - there can't be a gap after an infinite interval. return(GetZoneInterval(guessInterval.End)); } }
private ZoneInterval GetIntervalBeforeGap(LocalInstant localInstant) { Instant guess = localInstant.MinusZeroOffset(); ZoneInterval guessInterval = GetZoneInterval(guess); // If the local interval occurs before the zone interval we're looking at starts, // we need to find the earlier one; otherwise this interval must come after the gap, and // it's therefore the one we want. if (localInstant.Minus(guessInterval.WallOffset) < guessInterval.RawStart) { return(GetZoneInterval(guessInterval.Start - Duration.Epsilon)); } else { return(guessInterval); } }