30 lines
820 B
C
30 lines
820 B
C
#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 );
|
|
}
|