using (MemoryStream mem = new MemoryStream (bytes.Skip(4).toArray()))
{
using (BinaryReader reader = new BinaryReader(mem))
{
UInt32 time1;
UInt32 time2;
Int64 time = 0;
try{
time1 = reader.ReadInt32();
time2 = reader.ReadInt32();
time = (((Int64)time2) << 32) | time1;
return new DateTime(time);
}
catch{
}
}
}
I know this code is dealing with signed/unsigned integers and bit shifting, but I am not exactly sure I understand it as a whole. Could someone explain? Also what would be the reason behind this code giving an OutOfRange exception saying the number must be non-negative and less than or equal to Int32.maxvalue or -1 when this code is called in a Thread.Sleep?