#include <stdio.h>
#include <time.h>
void main( void )
{
/*
struct tm {
int tm_sec; // seconds after the minute - [0,59]
int tm_min; /* minutes after the hour - [0,59]
int tm_hour; /* hours since midnight - [0,23]
int tm_mday; /* day of the month - [1,31]
int tm_mon; /* months since January - [0,11]
int tm_year; /* years since 1900
int tm_wday; /* days since Sunday - [0,6]
int tm_yday; /* days since January 1 - [0,365]
int tm_isdst; /* daylight savings time flag
};
*/
tm systime;
_getsystime(&systime);
printf( "Current OS date and time: %s", asctime( &systime ) );
tm timetobeset;
// below is the value to be set for the system time ( I set it to 2004/12/01 0:00:00 ) :
timetobeset.tm_sec = 0; // seconds after the minute - [0,59]
timetobeset.tm_min = 0; // minutes after the hour - [0,59]
timetobeset.tm_hour = 0; // hours since midnight - [0,23]
timetobeset.tm_mday = 1; // day of the month - [1,31]
timetobeset.tm_mon = 11; // months since January - [0,11]
timetobeset.tm_year = 104; // years since 1900
timetobeset.tm_wday = 3; // days since Sunday - [0,6]
timetobeset.tm_yday = 335; // days since January 1 - [0,365]
timetobeset.tm_isdst= 0; // daylight savings time flag
// _setsystime(&timetobeset, 0);
printf( "Current OS date and time is set to be : %s", asctime( &timetobeset ) );
}