4 * Function to generate HTTP-compliant textual time/date stamp
5 * (This module was lifted directly from the Citadel server source)
11 static char *httpdate_months[] = {
12 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
13 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
16 static char *httpdate_weekdays[] = {
17 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
22 * Supplied with a unix timestamp, generate a textual time/date stamp
24 void http_datestring(char *buf, size_t n, time_t xtime) {
30 localtime_r(&xtime, &t);
32 /* Convert "seconds west of GMT" to "hours/minutes offset" */
33 #ifdef HAVE_STRUCT_TM_TM_GMTOFF
45 offset = ( (offset / 3600) * 100 ) + ( offset % 60 );
47 snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
48 httpdate_weekdays[t.tm_wday],
50 httpdate_months[t.tm_mon],