--- os2sdk/demos/examples/datetime/datetime.c 2018/08/09 12:25:13 1.1.1.1 +++ os2sdk/demos/examples/datetime/datetime.c 2018/08/09 12:26:23 1.1.1.2 @@ -1,36 +1,39 @@ /* - * Example of DOSGETDATETIME & DOSSETDATETIME usage + * Example of DosGetDateTime & DosSetDateTime usage * * These calls are used to set and get the current system time. * Also shows the structure of the information returned. * - * - on an IBM AT, DOSSETDATETIME changes the hardware real time clock + * - on an IBM AT, DosSetDateTime changes the hardware real time clock * - the system sets the 'timezone' value to -1 by default * - * Compile as: cl -AL -G2 -Lp datetime.c + * Compile as: cl -AL -G0 -Lp datetime.c * - * Copyright (C) Microsoft Corp. 1986 + * Created by Microsoft Corp. 1986 */ -#include +#define INCL_DOSDATETIME + +#include +#include main() { - struct DateTime curdt, newdt, setdt; + DATETIME curdt, newdt, setdt; /* Read current date and time */ - DOSGETDATETIME(&curdt); + DosGetDateTime(&curdt); /* Print date and time */ printf("TIME: %d:%02d:%02d.%02d DATE: %d/%d/%d DAY OF WEEK: %d\n", - curdt.hour,curdt.minutes,curdt.seconds,curdt.hundredths, - curdt.month,curdt.day,curdt.year,curdt.day_of_week); + curdt.hours,curdt.minutes,curdt.seconds,curdt.hundredths, + curdt.month,curdt.day,curdt.year,curdt.weekday); /* NOTE: the system sets the 'timezone' value to -1 by default */ printf("GMT = local_time %+d minutes\n",curdt.timezone); /* Set datetime struct to Thursday 12/25/86, 9:02:45.01pm PST */ - setdt.hour = 21; /* Time is in 24 hour format */ + setdt.hours = 21; /* Time is in 24 hour format */ setdt.minutes = 2; setdt.seconds = 45; setdt.hundredths = 1; @@ -40,17 +43,17 @@ main() setdt.timezone = 480; /* PST is 8 hours after GMT (480 minutes) */ /* Set system date and time */ - DOSSETDATETIME(&setdt); + DosSetDateTime(&setdt); /* Read new date and time just set */ - DOSGETDATETIME(&newdt); + DosGetDateTime(&newdt); /* Print date and time */ printf("TIME: %d:%02d:%02d.%02d DATE: %d/%d/%d DAY OF WEEK: %d\n", - newdt.hour,newdt.minutes,newdt.seconds,newdt.hundredths, - newdt.month,newdt.day,newdt.year,newdt.day_of_week); + newdt.hours,newdt.minutes,newdt.seconds,newdt.hundredths, + newdt.month,newdt.day,newdt.year,newdt.weekday); printf("GMT = local_time %+d minutes\n",newdt.timezone); /* Reset date and time to whatever was read at the beginning */ - DOSSETDATETIME(&curdt); + DosSetDateTime(&curdt); }