Пример #1
0
        /// <inheritdoc/>
        public override FudgeDateTime ReadTypedValue(BinaryReader input, int dataSize)
        {
            FudgeDate date = DateFieldType.Instance.ReadTypedValue(input, 0);

            int?timeZone;
            int seconds;
            int nanos;
            FudgeDateTimePrecision precision;

            TimeFieldType.ReadEncodedTime(input, out precision, out timeZone, out seconds, out nanos);

            // Time can't have a precision of worse than hours
            var timePrecision = (precision > FudgeDateTimePrecision.Day) ? precision : FudgeDateTimePrecision.Hour;
            var time          = new FudgeTime(timePrecision, seconds, nanos, timeZone);

            return(new FudgeDateTime(date, time, precision));
        }
Пример #2
0
 /// <inheritdoc/>
 public override void WriteValue(BinaryWriter output, FudgeDateTime value)
 {
     DateFieldType.Instance.WriteValue(output, value.Date);
     TimeFieldType.WriteEncodedTime(output, value.Precision, value.TimeZoneOffset, value.Time.TotalSeconds, value.Nanoseconds);
 }