Beispiel #1
0
 public static DateTime ValueToDate(long dateValue)
 {
     if ((dateValue < 0L) || (dateValue > 0xffffffffUL))
     {
         throw new ArgumentOutOfRangeException();
     }
     return(PlcOpenDateConverterBase.ToDateTime((uint)dateValue));
 }
        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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
0
 public static DateTime ValueToDate(uint dateValue) =>
 PlcOpenDateConverterBase.ToDateTime(dateValue);
Beispiel #6
0
 public static long DateToValue(DateTime date) =>
 ((long)PlcOpenDateConverterBase.ToTicks(date));