00001
00002
00003
00004
00005
00006
00007 #include <time.h>
00008 #include <stdio.h>
00009
00010
00011 int main ()
00012 {
00013 char strtime[256];
00014 struct tm tt;
00015 int i;
00016
00017 tt.tm_sec = 0;
00018 tt.tm_min = 0;
00019 tt.tm_hour = 0;
00020 tt.tm_mday = 1;
00021 tt.tm_year = 100;
00022 tt.tm_yday = 0;
00023 tt.tm_isdst = 0;
00024
00025
00026 fprintf (stdout, "\nchar *days[7] = { ");
00027
00028 for (i=0; i<6; i++)
00029 {
00030 tt.tm_wday = i;
00031 tt.tm_mon = 0;
00032 strftime (strtime, 256, "%a", &tt);
00033 fprintf (stdout, "\"%s\",", strtime);
00034 }
00035 tt.tm_wday = 6;
00036 strftime (strtime, 256, "%a", &tt);
00037 fprintf (stdout, "\"%s\" };", strtime);
00038
00039 fprintf (stdout, "\n\n");
00040
00041 fprintf (stdout, "\nchar *months[12] = { ");
00042
00043 for (i=0; i<11; i++)
00044 {
00045 tt.tm_wday = 0;
00046 tt.tm_mon = i;
00047 strftime (strtime, 256, "%b", &tt);
00048 fprintf (stdout, "\"%s\",", strtime);
00049 }
00050 tt.tm_mon = 11;
00051 strftime (strtime, 256, "%b", &tt);
00052 fprintf (stdout, "\"%s\" };", strtime);
00053
00054 fprintf (stdout, "\n\n");
00055
00056
00057
00058 return 0;
00059 }