NuoDb.Data.Client.EncodedDataStream.encodeDate C# (CSharp) Method

encodeDate() public method

public encodeDate ( DateTime date ) : void
date DateTime
return void
        public virtual void encodeDate(DateTime date)
        {
            if (date == null)
            {
                write(edsNull);

                return;
            }

            TimeSpan span = date.ToUniversalTime() - baseDate;
            long value = (long)(span.TotalMilliseconds);
            int count = byteCount(value);
            write(edsMilliSecLen0 + count);

            for (int shift = (count - 1) * 8; shift >= 0; shift -= 8)
            {
                write((int)(value >> shift));
            }
        }

Usage Example

Esempio n. 1
0
 internal override void encodeValue(EncodedDataStream dataStream)
 {
     dataStream.encodeDate(value);
 }