4 * Function to generate RFC822-compliant textual time/date stamp
16 static char *months[] = {
17 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
18 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
21 static char *weekdays[] = {
22 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
27 * Supplied with a unix timestamp, generate an RFC822-compliant textual
28 * time and date stamp.
30 void datestring(char *buf, time_t xtime, int which_format) {
36 t = localtime(&xtime);
38 /* Convert "seconds west of GMT" to "hours/minutes offset" */
47 offset = ( (offset / 3600) * 100 ) + ( offset % 60 );
49 switch(which_format) {
51 case DATESTRING_RFC822:
52 sprintf(buf, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
65 sprintf(buf, "%02d-%s-%04d %02d:%02d:%02d %c%04ld",