public void dostounix_Test(int month, int day, int year, int hour, int minute, int second) { //Reset State Reset(); fakeClock.Now = new DateTime(year, month, day, hour, minute, second); var expectedUnixDate = ((DateTimeOffset)fakeClock.Now).ToUnixTimeSeconds(); var inputDateStruct = new DateStruct(fakeClock.Now); var inputTimeStruct = new TimeStruct(fakeClock.Now); //Set Argument Values to be Passed In var dateStringPointer = mbbsEmuMemoryCore.AllocateVariable("DATE_STRING", (DateStruct.Size)); mbbsEmuMemoryCore.SetArray(dateStringPointer, inputDateStruct.Data); var timeStringPointer = mbbsEmuMemoryCore.AllocateVariable("TIME_STRING", TimeStruct.Size); mbbsEmuMemoryCore.SetArray(timeStringPointer, inputTimeStruct.Data); //Execute Test ExecuteApiTest(HostProcess.ExportedModules.Majorbbs.Segment, DOSTOUNIX_ORDINAL, new List <FarPtr> { dateStringPointer, timeStringPointer }); //Verify Results Assert.Equal(expectedUnixDate, mbbsEmuCpuRegisters.GetLong()); }
static void Main(string[] args) { DateStruct sDay; sDay.year = 2018; sDay.month = 11; sDay.day = 22; Console.WriteLine("sDay: {0}/{1}/{2}", sDay.year, sDay.month, sDay.day); DateClass cDay = new DateClass(); cDay.year = 2018; cDay.month = 11; cDay.day = 22; Console.WriteLine("cDay: {0}/{1}/{2}", cDay.year, cDay.month, cDay.day); DateStruct sDay2 = new DateStruct(); Console.WriteLine("sDay2: {0}/{1}/{2}", sDay2.year, sDay2.month, sDay2.day); DateClass cDay2 = new DateClass(); Console.WriteLine("cDay2: {0}/{1}/{2}", cDay2.year, cDay2.month, cDay2.day); DateStruct s = sDay; DateClass c = cDay; s.year = 2000; c.year = 2000; Console.WriteLine("s: {0}/{1}/{2}", s.year, s.month, s.day); Console.WriteLine("c: {0}/{1}/{2}", c.year, c.month, c.day); Console.WriteLine("sDay: {0}/{1}/{2}", sDay.year, sDay.month, sDay.day); Console.WriteLine("cDay: {0}/{1}/{2}", cDay.year, cDay.month, cDay.day); }
//C** Реализовать собственную структуру «Дата». //Функции «Дата»: ввод даты, прибавление к дате определенного числа дней, вычисление разницы между двумя датами, // определение високосного года, выводы даты с указанием месяца цифрой и словом public static void DateCalculation() { Console.Clear(); DateStruct firstDate = new DateStruct(); DateStruct secondDate = new DateStruct(); int dayDif, monthDif, yearDif; firstDate = DateInput(); secondDate = DateInput(); firstDate.monthName = MonthName(firstDate.month); secondDate.monthName = MonthName(secondDate.month); dayDif = firstDate.day - secondDate.day; monthDif = firstDate.month - secondDate.month; yearDif = firstDate.year - secondDate.year; Console.WriteLine("Первая дата: \t\t{0} {1} {2} год", firstDate.day, firstDate.monthName, firstDate.year); Console.WriteLine("Вторая дата: \t\t{0} {1} {2} год", secondDate.day, secondDate.monthName, secondDate.year); Console.WriteLine("Отличия дат на: \t{0} дня(ей), {1} месяц(ев), {2} лет", dayDif, monthDif, yearDif); Console.ReadKey(); }
public void LoadFromFille(out DateStruct loadInfoGame) { if (!File.Exists(_savePath)) { Debug.Log("{GameLog}=>{GameCore} - LoadFromFile ->File Not Found"); loadInfoGame = default; return; } try { string json = File.ReadAllText(_savePath); loadInfoGame = JsonUtility.FromJson <DateStruct>(json); } catch (Exception e) { loadInfoGame = default; Debug.Log(e); } }
public static void Main(string[] args) { DateClass p, q; p = new DateClass(2004, 1, 1); q = p; p.addDay(); p.display(); q.display(); DateStruct m, n; m = new DateStruct(2004, 1, 1); n = m; m.addDay(); m.display(); n.display(); Console.Read(); }
public void getdate_Test(int month, int day, int year) { //Reset State Reset(); //Set Argument Values to be Passed In fakeClock.Now = new DateTime(year, month, day); var dateStringPointer = mbbsEmuMemoryCore.AllocateVariable("DATE_STRING", (DateStruct.Size)); //Execute Test ExecuteApiTest(HostProcess.ExportedModules.Majorbbs.Segment, GETDATE_ORDINAL, new List <FarPtr> { dateStringPointer }); //Verify Results var expectedDateStruct = new DateStruct(mbbsEmuMemoryCore.GetArray(dateStringPointer, DateStruct.Size)); var expectedDate = new DateTime(expectedDateStruct.year, expectedDateStruct.month, expectedDateStruct.day); Assert.Equal(fakeClock.Now, expectedDate); }
public static DateStruct DateInput() { DateStruct outputDate = new DateStruct(); string inputDate; string dayStr = "", monthStr = "", yearStr = ""; Console.Write("Введите дату в формате ДДММГГГГ: "); inputDate = Console.ReadLine(); for (int i = 0; i < inputDate.Length; i += 2) { if (i < 1) { dayStr = string.Join("", inputDate[i], inputDate[i + 1]); int.TryParse(dayStr, out outputDate.day); if (outputDate.day >= 31) { Console.WriteLine("Неправельный день"); } } else if (i < 3) { monthStr = string.Join("", inputDate[i], inputDate[i + 1]); int.TryParse(monthStr, out outputDate.month); if (outputDate.month > 13) { Console.WriteLine("Неправельный месяц"); } } else if (i < 5) { yearStr = string.Join("", inputDate[i], inputDate[i + 1], inputDate[i + 2], inputDate[i + 3]); int.TryParse(yearStr, out outputDate.year); } } return(outputDate); }
public static DateStruct DateInput() { DateStruct outputDate = new DateStruct(); string inputDate; string dayStr="", monthStr = "", yearStr = ""; Console.Write("Введите дату в формате ДДММГГГГ: "); inputDate = Console.ReadLine(); for (int i = 0; i < inputDate.Length; i += 2) { if (i < 1) { dayStr = string.Join("", inputDate[i], inputDate[i + 1]); int.TryParse(dayStr, out outputDate.day); if (outputDate.day >= 31) { Console.WriteLine("Неправельный день"); } } else if (i < 3) { monthStr = string.Join("", inputDate[i], inputDate[i + 1]); int.TryParse(monthStr, out outputDate.month); if (outputDate.month > 13) { Console.WriteLine("Неправельный месяц"); } } else if (i < 5) { yearStr = string.Join("", inputDate[i], inputDate[i + 1], inputDate[i + 2], inputDate[i + 3]); int.TryParse(yearStr, out outputDate.year); } } return outputDate; }
public int iV_GetLicenseDueDate(ref DateStruct licenseDueDate) { return(Unmanaged_GetLicenseDueDate(ref licenseDueDate)); }
private static extern int Unmanaged_GetLicenseDueDate(ref DateStruct licenseDueDate);
public int iV_GetLicenseDueDate(ref DateStruct licenseDueDate) { return Unmanaged_GetLicenseDueDate(ref licenseDueDate); }