예제 #1
0
        /// <summary>
        /// Gets date and time from the buffer.
        /// </summary>
        public static DateTime GetTime(byte[] buffer, ref int index)
        {
            DateTime value = ScadaUtils.TicksToTime(BitConverter.ToInt64(buffer, index));

            index += 8;
            return(value);
        }
예제 #2
0
        /// <summary>
        /// Formats the channel value, which is a date and time.
        /// </summary>
        protected string FormatDate(double cnlVal, int dataTypeID, string format)
        {
            string DateToString(DateTime dt)
            {
                return(TimeZoneInfo.ConvertTimeFromUtc(dt, timeZone).ToString(format, culture));
            }

            switch (dataTypeID)
            {
            case DataTypeID.Double:
                return(DateToString(DateTime.FromOADate(cnlVal)));

            case DataTypeID.Int64:
                return(DateToString(ScadaUtils.TicksToTime(CnlDataConverter.DoubleToInt64(cnlVal))));

            default:
                return(FormatError);
            }
        }
예제 #3
0
 /// <summary>
 /// Gets date and time from the buffer.
 /// </summary>
 public static DateTime GetTime(byte[] buffer, int index)
 {
     return(ScadaUtils.TicksToTime(BitConverter.ToInt64(buffer, index)));
 }