using System.Runtime.InteropServices;
public static void Main()
var x = StringToByteArray("B400000000000000C4FFFFFF000002000600040017003B003B00E70300000A000600020017003B003B00E703");
Console.WriteLine(z.daylightDate);
public static TZI Parse(byte[] info)
if (info.Length != Marshal.SizeOf(tzi))
throw new ArgumentException(string.Format("Byte object must be of size {0}, got {1}", Marshal.SizeOf(tzi), info.Length));
GCHandle h = GCHandle.Alloc(info, GCHandleType.Pinned);
return (TZI)Marshal.PtrToStructure(h.AddrOfPinnedObject(), typeof(TZI));
public static byte[] StringToByteArray(string hex) {
return Enumerable.Range(0, hex.Length)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
[StructLayout(LayoutKind.Sequential)]
public SystemTime standardDate;
public SystemTime daylightDate;