System.TimeZoneInfo.ParseTimesTypes C# (CSharp) Method

ParseTimesTypes() static private method

static private ParseTimesTypes ( byte buffer, int index, int count, string>.Dictionary abbreviations ) : TimeType>.Dictionary
buffer byte
index int
count int
abbreviations string>.Dictionary
return TimeType>.Dictionary
		static Dictionary<int, TimeType> ParseTimesTypes (byte [] buffer, int index, int count, Dictionary<int, string> abbreviations)
		{
			var types = new Dictionary<int, TimeType> (count);
			for (int i = 0; i < count; i++) {
				int offset = ReadBigEndianInt32 (buffer, index + 6 * i);

				//
				// The official tz database contains timezone with GMT offsets
				// not only in whole hours/minutes but in seconds. This happens for years
				// before 1901. For example
				//
				// NAME		        GMTOFF   RULES	FORMAT	UNTIL
				// Europe/Madrid	-0:14:44 -	LMT	1901 Jan  1  0:00s
				//
				// .NET as of 4.6.2 cannot handle that and uses hours/minutes only, so
				// we remove seconds to not crash later
				//
				offset = (offset / 60) * 60;

				byte is_dst = buffer [index + 6 * i + 4];
				byte abbrev = buffer [index + 6 * i + 5];
				types.Add (i, new TimeType (offset, (is_dst != 0), abbreviations [(int)abbrev]));
			}
			return types;
		}