en:docs:fapi:dossetdatetime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:docs:fapi:dossetdatetime [2021/08/20 04:22] prokusheven:docs:fapi:dossetdatetime [2021/12/05 11:01] (current) prokushev
Line 5: Line 5:
 This call is used to set the date and time that are maintained by the operating system. This call is used to set the date and time that are maintained by the operating system.
  
-==Syntax== +===== Syntax =====
- DosSetDateTime (DateTime)+
  
-==Parameters== +<code c> 
-;DateTime (PDATETIME) - input : Address of the date and time structure: +DosSetDateTime (DateTime) 
-::hours (UCHAR) - Current hour (0-23) +</code> 
-::minutes (UCHAR) - Current minute (0-59) + 
-::seconds (UCHAR) - Current second (0-59) +===== Parameters ===== 
-::hundredths (UCHAR) - Current hundredth of a second (0-99) + 
-::day (UCHAR) - Current day (1-31) +  * DateTime ([[PDATETIME]]) - input : Address of the date and time structure: 
-::month (UCHAR) - Current month (1-12) +    hours ([[UCHAR]]) - Current hour (0-23) 
-::year (USHORT) - Current year (1980-2079) +    minutes ([[UCHAR]]) - Current minute (0-59) 
-::timezone (SHORT) - Minutes west of UTC (Universal Time Coordinate -720 to 720).  +    seconds ([[UCHAR]]) - Current second (0-59) 
-::weekday (UCHAR) - Current day of the week. This value is ignored and is calculated from the other parameter information.+    hundredths ([[UCHAR]]) - Current hundredth of a second (0-99) 
 +    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== 
- rc (USHORT) - return 
 Return code descriptions are: Return code descriptions are:
-* 0 NO_ERROR 
-*327 ERROR_TS_DATETIME 
  
-==Remarks==+  * 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). 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, it is more efficient to obtain these variables by calling DosGetInfoSeg instead of this function. However, applications written to the family API cannot depend on the availability of DosGetInfoSeg.+To get the date and time, issue [[DosGetDateTime]]. If the application is executing in the OS/2 environment, it is more efficient to obtain these variables by calling [[DosGetInfoSeg]] instead of this function. However, applications written to the family API cannot depend on the availability of [[DosGetInfoSeg]].
  
 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.  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== +===== Example Code ===== 
-===C Binding=== + 
-<PRE>+==== C Binding ===
 + 
 +<code c>
 typedef struct _DATETIME {  /* date */ typedef struct _DATETIME {  /* date */
   UCHAR   hours;            /* current hour */   UCHAR   hours;            /* current hour */
Line 53: Line 63:
 PDATETIME DateTime;      /* Date/time structure */ PDATETIME DateTime;      /* Date/time structure */
 USHORT    rc;            /* return code */ USHORT    rc;            /* return code */
-</PRE>+</code> 
 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.  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>+ 
 +<code c>
 #define INCL_DOSDATETIME #define INCL_DOSDATETIME
 #include <os2.h> #include <os2.h>
Line 75: Line 87:
   printf("rc is %d\n", rc);   printf("rc is %d\n", rc);
  }  }
-</PRE>+</code>
  
-===MASM Binding=== +==== MASM Binding ===
-<pre>+ 
 +<code c>
 DATETIME struc DATETIME struc
   date_hours      db  ? ;current hour   date_hours      db  ? ;current hour
Line 96: Line 109:
 PUSH@  OTHER   DateTime      ;Date/time structure PUSH@  OTHER   DateTime      ;Date/time structure
 CALL   DosSetDateTime CALL   DosSetDateTime
 +</code>
  
 Returns WORD Returns WORD
-</pre> 
- 
- 
  
-====== Note ======+===== Note =====
  
 Text based on [[http://www.edm2.com/index.php/DosSetDateTime_(Legacy)]] Text based on [[http://www.edm2.com/index.php/DosSetDateTime_(Legacy)]]