dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosGetDateTime (1.2)
Function Group                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSDATETIME
 
USHORT DosGetDateTime(pdateTime)
PDATETIME pdateTime;    /* pointer to structure for date and time */
 
The DosGetDateTime function retrieves the current date and time. Although MS
OS/2 maintains the current date and time, any process can change the date
and time by using the DosSetDateTime function; as a result, the current date
and time are as accurate as the most recent call to the DosSetDateTime
function.
 
The DosGetDateTime function is a family API function.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
pdateTime  Points to the DATETIME structure that receives the date and time
           information.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value.
 
Comments
 
A process can also retrieve the current date and time by using the
DosGetInfoSeg function. However, DosGetInfoSeg is not a family API function
so it is not available to programs running in DOS compatibility mode.
 
Example
 
This example calls the DosGetDateTime function repeatedly until the time is
9:30:
 
DATETIME date;
do                                   /* do until 9:30 */
    DosGetDateTime(&date);
while (!(date.hours == 9 && date.minutes == 30))
 
See Also
 
DosGetInfoSeg, DosSetDateTime, DATETIME