/// <inheritdoc />
        public DateTimeZone GetZoneOrNull([NotNull] string id)
        {
            Preconditions.CheckNotNull(id, nameof(id));
            DateTimeZone fixedZone = FixedDateTimeZone.GetFixedZoneOrNull(id);

            if (fixedZone != null)
            {
                return(fixedZone);
            }
            lock (accessLock)
            {
                DateTimeZone zone;
                if (!timeZoneMap.TryGetValue(id, out zone))
                {
                    return(null);
                }
                if (zone == null)
                {
                    zone = source.ForId(id);
                    if (zone == null)
                    {
                        throw new InvalidDateTimeZoneSourceException("Time zone " + id + " is supported by source " + VersionId + " but not returned");
                    }
                    timeZoneMap[id] = zone;
                }
                return(zone);
            }
        }
Exemple #2
0
 /// <inheritdoc />
 public DateTimeZone?GetZoneOrNull(string id)
 {
     Preconditions.CheckNotNull(id, nameof(id));
     return(GetZoneFromSourceOrNull(id) ?? FixedDateTimeZone.GetFixedZoneOrNull(id));
 }