Ejemplo n.º 1
0
        private static void ReadPrecalculatedTimeZone(DateTimeZoneReader reader)
        {
            int size = reader.ReadCount();

            Console.WriteLine($"  Precalculated intervals: {size}");
            var start = reader.ReadZoneIntervalTransition(null);

            for (int i = 0; i < size; i++)
            {
                var name      = reader.ReadString();
                var offset    = reader.ReadOffset();
                var savings   = reader.ReadOffset();
                var nextStart = reader.ReadZoneIntervalTransition(start);
                Console.WriteLine(Invariant($"  {start:yyyy-MM-dd'T'HH:mm:ss} - {nextStart:yyyy-MM-dd'T'HH:mm:ss}; wall offset: {offset}; savings: {savings}; name: {name}"));
                start = nextStart;
            }
            if (reader.ReadByte() == 1)
            {
                Offset         standardOffset     = reader.ReadOffset();
                string         standardName       = reader.ReadString();
                ZoneYearOffset standardYearOffset = ZoneYearOffset.Read(reader);
                string         daylightName       = reader.ReadString();
                ZoneYearOffset daylightYearOffset = ZoneYearOffset.Read(reader);
                Offset         savings            = reader.ReadOffset();
                Console.WriteLine("  Tail zone:");
                Console.WriteLine($"    Standard time: {standardYearOffset}; offset: {standardOffset}; name: {standardName}");
                Console.WriteLine($"    Daylight time: {daylightYearOffset}; offset: {standardOffset + savings}; name: {daylightName}");
            }
            else
            {
                Console.WriteLine("  No tail zone");
            }
        }
Ejemplo n.º 2
0
 private static void ReadFixedTimeZone(DateTimeZoneReader reader)
 {
     Console.WriteLine($"  Offset: {reader.ReadOffset()}");
     if (reader.HasMoreData)
     {
         Console.WriteLine($"  Name: {reader.ReadString()}");
     }
 }