Opc.Ua.BinaryDecoder.ReadDateTime C# (CSharp) Method

ReadDateTime() public method

Reads a UTC date/time from the stream.
public ReadDateTime ( string fieldName ) : System.DateTime
fieldName string
return System.DateTime
        public DateTime ReadDateTime(string fieldName)
        {
            long ticks = m_reader.ReadInt64();

            if (ticks >= (Int64.MaxValue - Utils.TimeBase.Ticks))
            {
                return DateTime.MaxValue;
            }

            ticks += Utils.TimeBase.Ticks;

            if (ticks >= DateTime.MaxValue.Ticks)
            {
                return DateTime.MaxValue;
            }

            if (ticks <= Utils.TimeBase.Ticks)
            {
                return DateTime.MinValue;
            }

            return new DateTime(ticks, DateTimeKind.Utc);
        }