
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <dos.h>
unsigned _dos_setdate( struct dosdate_t *date );
struct dosdate_t {
unsigned char day; /* 1-31 */
unsigned char month; /* 1-12 */
unsigned short year; /* 1980-2099 */
unsigned char dayofweek;/* 0-6 (0=Sunday) */
};
Description:
The _dos_setdate function uses system call 0x2B to set the current
system date. The date information is passed in a dosdate_t structure
pointed to by date.
Returns:
The _dos_setdate function returns zero if successful. Otherwise, it
returns a non-zero value and sets errno to EINVAL indicating that an
invalid date was given.
See Also:
_dos_getdate, _dos_gettime, _dos_settime, gmtime Functions, localtime Functions, mktime,
time
Example:
#include <stdio.h>
#include <dos.h>
void main()
{
struct dosdate_t date;
struct dostime_t time;
/* Get and display the current date and time */
_dos_getdate( &date );
_dos_gettime( &time );
printf( "The date (MM-DD-YYYY) is: %d-%d-%d\n",
date.month, date.day, date.year );
printf( "The time (HH:MM:SS) is: %.2d:%.2d:%.2d\n",
time.hour, time.minute, time.second );
/* Change it to the turn of the century */
date.year = 1999;
date.month = 12;
date.day = 31;
time.hour = 23;
time.minute = 59;
_dos_setdate( &date );
_dos_settime( &time );
printf( "New date (MM-DD-YYYY) is: %d-%d-%d\n",
date.month, date.day, date.year );
printf( "New time (HH:MM:SS) is: %.2d:%.2d:%.2d\n",
time.hour, time.minute, time.second );
}
produces the following:
The date (MM-DD-YYYY) is: 12-25-1989
The time (HH:MM:SS) is: 14:23:15
New date (MM-DD-YYYY) is: 12-31-1999
New time (HH:MM:SS) is: 23:59:16
Classification:
DOS
Systems:
DOS, Win, OS/2 1.x(all), OS/2 2.x, NT, DOS/PM
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson