00001
00002
00003
00004
00005
00006
00007 #include <time.h>
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010
00011
00012 int main (int argc, char *argv[])
00013 {
00014 char strtime[256];
00015 struct tm tt;
00016 int i;
00017 int n;
00018
00019 if (argc != 2)
00020 {
00021 fprintf (stdout, "\nUsage: rand_dates.test number\n");
00022 return 1;
00023 }
00024
00025 n = atoi(argv[1]);
00026
00027 for (i=0; i<n; i++)
00028 {
00029 tt.tm_sec = rand() % 60;
00030 tt.tm_min = rand() % 60;
00031 tt.tm_hour = rand() % 24;
00032 tt.tm_mday = rand() % 28;
00033 tt.tm_mon = rand() % 12;
00034 tt.tm_year = (rand() % 130)+1;
00035 tt.tm_wday = rand() % 7;
00036 tt.tm_yday = rand() % 365;
00037 tt.tm_isdst = 0;
00038
00039 strftime (strtime, 256, "%a %b %m %H:%M:%S MET DST %Y", &tt);
00040 fprintf (stdout, "\n./date2timestamp.test \"%s\" >> timestamps", strtime);
00041 }
00042
00043 return 0;
00044 }