예제 #1
0
        public static bool GetCNCDate(ushort handle, out DateTime date)
        {
            date = DateTime.MinValue;
            FocasLibBase.IODBTIMER a = new FocasLibBase.IODBTIMER();
            a.type = 0; // 0 = Date ; 1 = time
            short ret = FocasLib.cnc_gettimer(handle, a);

            if (ret != 0)
            {
                Logger.WriteErrorLog("cnc_gettimer() failed. return value is = " + ret);
                return(false);
            }
            date = new DateTime(a.date.year, a.date.month, a.date.date);
            return(true);
        }
예제 #2
0
        public static bool GetCNCTime(ushort handle, out TimeSpan time)
        {
            time = TimeSpan.Zero;
            FocasLibBase.IODBTIMER a = new FocasLibBase.IODBTIMER();
            a.type = 1; // 0 = Date ; 1 = time
            short ret = FocasLib.cnc_gettimer(handle, a);

            if (ret != 0)
            {
                Logger.WriteErrorLog("cnc_gettimer() failed. return value is = " + ret);
                return(false);
            }
            time = new TimeSpan(a.time.hour, a.time.minute, a.time.second);
            return(true);
        }