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); }
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); }
public static bool SetCNCTime(ushort handle, DateTime date) { FocasLibBase.IODBTIMER a = new FocasLibBase.IODBTIMER(); a.type = 1; // 0 = Date ; 1 = time a.time.hour = (short)date.Hour; a.time.minute = (short)date.Minute; a.time.second = (short)date.Second; short ret = FocasLib.cnc_settimer(handle, a); if (ret != 0) { Logger.WriteErrorLog("Setting CNC Time failed (cnc_settimer() return value is = " + ret); return(false); } return(true); }
public static bool SetCNCDate(ushort handle, DateTime date) { FocasLibBase.IODBTIMER a = new FocasLibBase.IODBTIMER(); a.type = 0; // 0 = Date ; 1 = time a.date.date = (short)date.Day; a.date.month = (short)date.Month; a.date.year = (short)date.Year; short ret = FocasLib.cnc_settimer(handle, a); if (ret != 0) { Logger.WriteErrorLog("Setting CNC date failed (cnc_settimer() return value is = " + ret); return(false); } return(true); }