示例#1
0
 public static DateTime ValueToDate(long dateValue)
 {
     if ((dateValue < 0L) || (dateValue > 0xffffffffUL))
     {
         throw new ArgumentOutOfRangeException();
     }
     return(PlcOpenDateConverterBase.ToDateTime((uint)dateValue));
 }
示例#2
0
        public static bool TryParse(string s, out TOD tod)
        {
            uint     num;
            TimeSpan span;

            if (TryParseToTicks(s, out num))
            {
                tod = new TOD(num);
                return(true);
            }
            if (PlcOpenDateConverterBase.TryParseTimeSpan(s, out span))
            {
                tod = new TOD(span);
                return(true);
            }
            tod = null;
            return(false);
        }
示例#3
0
        public static bool TryParse(string s, out TIME time)
        {
            TimeSpan span;
            uint     milliseconds = 0;

            if (TryParseToMilliseconds(s, out milliseconds))
            {
                time = new TIME(milliseconds);
                return(true);
            }
            if (PlcOpenDateConverterBase.TryParseTimeSpan(s, out span))
            {
                time = new TIME(span);
                return(true);
            }
            time = null;
            return(false);
        }
示例#4
0
        public static bool TryParse(string s, out LTIME time)
        {
            TimeSpan span;
            ulong    nanoseconds = 0UL;

            if (TryParseToNanoseconds(s, out nanoseconds))
            {
                time = new LTIME(nanoseconds);
                return(true);
            }
            if (PlcOpenDateConverterBase.TryParseTimeSpan(s, out span))
            {
                time = new LTIME(span);
                return(true);
            }
            time = null;
            return(false);
        }
示例#5
0
 public static DateTime ValueToDate(uint dateValue) =>
 PlcOpenDateConverterBase.ToDateTime(dateValue);
示例#6
0
 public static long DateToValue(DateTime date) =>
 ((long)PlcOpenDateConverterBase.ToTicks(date));