no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | en:docs:fapi:dossetdatetime [2018/08/31 07:25] – created prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | This call is used to set the date and time that are maintained by the operating system. | ||
+ | |||
+ | ==Syntax== | ||
+ | | ||
+ | |||
+ | ==Parameters== | ||
+ | ;DateTime (PDATETIME) - input : Address of the date and time structure: | ||
+ | ::hours (UCHAR) - Current hour (0-23) | ||
+ | ::minutes (UCHAR) - Current minute (0-59) | ||
+ | ::seconds (UCHAR) - Current second (0-59) | ||
+ | :: | ||
+ | ::day (UCHAR) - Current day (1-31) | ||
+ | ::month (UCHAR) - Current month (1-12) | ||
+ | ::year (USHORT) - Current year (1980-2079) | ||
+ | ::timezone (SHORT) - Minutes west of UTC (Universal Time Coordinate -720 to 720). | ||
+ | ::weekday (UCHAR) - Current day of the week. This value is ignored and is calculated from the other parameter information. | ||
+ | |||
+ | ==Return Code== | ||
+ | rc (USHORT) - return | ||
+ | Return code descriptions are: | ||
+ | * 0 NO_ERROR | ||
+ | *327 ERROR_TS_DATETIME | ||
+ | |||
+ | ==Remarks== | ||
+ | The value of timezone is the difference in minutes between the current time zone and UTC. This is a positive number if earlier than UTC, and negative number if it is later. For Eastern Standard Time this value is 300 (five hours earlier than UTC). | ||
+ | |||
+ | To get the date and time, issue DosGetDateTime. If the application is executing in the OS/2 environment, | ||
+ | |||
+ | Not adhering to the limits on any of the parameters results in the return code being set to rc = 327 (ERROR_TS_DATETIME). Also, OS/2 verifies that the day is possible for the month and the year (even for leap year). If the day is not reasonable, OS/2 will also set rc = 327. | ||
+ | |||
+ | ==Example Code== | ||
+ | ===C Binding=== | ||
+ | <PRE> | ||
+ | typedef struct _DATETIME { /* date */ | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | UCHAR | ||
+ | USHORT | ||
+ | SHORT | ||
+ | UCHAR | ||
+ | } DATETIME; | ||
+ | |||
+ | #define INCL_DOSDATETIME | ||
+ | |||
+ | USHORT | ||
+ | PDATETIME DateTime; | ||
+ | USHORT | ||
+ | </ | ||
+ | The following example obtains and prints date and time information. It then changes the system date to 5/10/1987 and prints the updated information. | ||
+ | <PRE> | ||
+ | #define INCL_DOSDATETIME | ||
+ | #include < | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | DATETIME | ||
+ | USHORT | ||
+ | |||
+ | rc = DosGetDateTime(& | ||
+ | printf(" | ||
+ | | ||
+ | DateTime.day = 10; | ||
+ | DateTime.month = 5; | ||
+ | DateTime.year = 1987; | ||
+ | printf(" | ||
+ | | ||
+ | rc = DosSetDateTime(& | ||
+ | printf(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===MASM Binding=== | ||
+ | <pre> | ||
+ | DATETIME struc | ||
+ | date_hours | ||
+ | date_minutes | ||
+ | date_seconds | ||
+ | date_hundredths db ? ;current hundredths of a second | ||
+ | date_day | ||
+ | date_month | ||
+ | date_year | ||
+ | date_timezone | ||
+ | date_weekday | ||
+ | DATETIME ends | ||
+ | |||
+ | EXTRN DosSetDateTime: | ||
+ | INCL_DOSDATETIME | ||
+ | |||
+ | PUSH@ OTHER | ||
+ | CALL | ||
+ | |||
+ | Returns WORD | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== Note ====== | ||
+ | |||
+ | Text based on [[http:// | ||
+ | |||
+ | {{page> | ||