System.Data.SqlClient.SqlBuffer.FillInTimeInfo C# (CSharp) Method

FillInTimeInfo() private static method

private static FillInTimeInfo ( TimeInfo &timeInfo, byte timeBytes, int length, byte scale ) : void
timeInfo TimeInfo
timeBytes byte
length int
scale byte
return void
        private static void FillInTimeInfo(ref TimeInfo timeInfo, byte[] timeBytes, int length, byte scale)
        {
            Debug.Assert(3 <= length && length <= 5, "invalid data length for timeInfo: " + length);
            Debug.Assert(0 <= scale && scale <= 7, "invalid scale: " + scale);

            Int64 tickUnits = (Int64)timeBytes[0] + ((Int64)timeBytes[1] << 8) + ((Int64)timeBytes[2] << 16);
            if (length > 3)
            {
                tickUnits += ((Int64)timeBytes[3] << 24);
            }
            if (length > 4)
            {
                tickUnits += ((Int64)timeBytes[4] << 32);
            }
            timeInfo.ticks = tickUnits * TdsEnums.TICKS_FROM_SCALE[scale];
            timeInfo.scale = scale;
        }