
#include<time.h>
#include<stdio.h>

#define CGI_311

main(int argc, char *argv[])
{
   char timestr[30] = "notime";
   char datestr[30] = "nodate";
   char junk[80];
   struct tm *timerec;
   time_t timenum;
   char GHMonthList[12][4]={"Jan","Feb","Mar","Apr","May","Jun",
                             "Jul","Aug","Sep","Oct","Nov","Dec"};

#ifdef CGI_311
   freopen(argv[7],"r",stdin);
   freopen(argv[8],"w",stdout);
#endif
     
   timenum = time( NULL );
   timerec = localtime(&timenum);
   sprintf( timestr, "%2d:%02d:%02d", timerec->tm_hour, timerec->tm_min, timerec->tm_sec);
   sprintf( datestr, "%s. %2d, 19%d", GHMonthList[timerec->tm_mon], timerec->tm_mday,  timerec->tm_year);

   printf("<HTML>\n");
   printf("<HEAD>\n");
   printf("<title>Server Time</title>\n");
   printf("</HEAD>\n");
   printf("<BODY>\n");
   printf("<h2>The current time on <em>www.nstep.com</em> is %s on %s.</h2>\n",timestr, datestr);
   printf("<hr>\n");
   printf("<em>This script was developed by <a href=\"http://www.nstep.com/\">");
   printf("Instep Enterprises, Inc.</a></em>\n");
   printf("</BODY>\n");
   printf("</HTML>\n");
}

