[ Home |
Alpha index |
Topic index |
Tutorials |
Download |
Feedback ]
The OS/2 API Project
DosGetDateTime
[ Syntax |
Params |
Returns |
Include |
Usage |
Structs |
Gotchas |
Code |
Also ]
Syntax
rc = DosGetDateTime( pdt );
Parameters
-
PDATETIME pdt (output)
-
A pointer to a DATETIME-structure in which the current system date and time will
be stored.
Returns
APIRET rc
0 NO_ERROR
Include Info
#define INCL_DOSDATETIME
#include <os2.h>
Usage Explanation
DosGetDateTime gets the current date and time for the system.
Relevant Structures
typedef struct _DATETIME
{
UCHAR hours; /* 0..23 */
UCHAR minutes; /* 0..59 */
UCHAR seconds; /* 0..59 */
UCHAR hundredths; /* 0..99, 1/100 s */
UCHAR day; /* 0..31 */
UCHAR month; /* 0..12 */
USHORT year;
SHORT timezone; /* Difference in minutes between current time zone */
/* and GMT. >0 = west of Greenwich, -1 = undefined */
/* time zone. */
UCHAR weekday; /* 0..6 0=Sunday */
} DATETIME, *PDATETIME;
Gotchas
The sign of the time zone is opposed to that ordinary used. Ie GMT+1 (Western
Europe) <=> -60
Sample Code
#define INCL_DOSDATETIME
#include
#include /* For printf */
DATETIME dt;
APIRET rc;
rc=DosGetDateTime(&dt); /* Get current time and date */
printf("The time is %d:%d:%d\n",
(short)dt.hours,
(short)dt.minutes,
(short)dt.seconds);
See Also
DosSetDateTime
Author
Oscar Gustafsson -
oscar@lysator.liu.se
Additions
Last modified September 21/1996
Please send all errors, comments, and suggestions to:
timur@vnet.ibm.com
The OS/2 API Project |
DosGetDateTime |