This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/mktime.c

24 lines
523 B
C
Raw Permalink Normal View History

#include <stdio.h>
#include <time.h>
static const char *week_day[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
};
void main()
{
struct tm new_year;
new_year.tm_year = 2001 - 1900;
new_year.tm_mon = 0;
new_year.tm_mday = 1;
new_year.tm_hour = 0;
new_year.tm_min = 0;
new_year.tm_sec = 0;
new_year.tm_isdst = 0;
mktime( &new_year );
printf( "The 21st century began on a %s\n",
week_day[ new_year.tm_wday ] );
}