5 * \defgroup HTTPDateTime Function to generate HTTP-compliant textual time/date stamp
6 * (This module was lifted directly from the Citadel server source)
12 /** HTTP Months - do not translate - these are not for human consumption */
13 static char *httpdate_months[] = {
14 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
15 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
18 /** HTTP Weekdays - do not translate - these are not for human consumption */
19 static char *httpdate_weekdays[] = {
20 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
25 * \brief Supplied with a unix timestamp, generate a textual time/date stamp
26 * \param buf the return buffer
27 * \param n the size of the buffer
28 * \param xtime the time to format as string
30 void http_datestring(char *buf, size_t n, time_t xtime) {
36 localtime_r(&xtime, &t);
38 /** Convert "seconds west of GMT" to "hours/minutes offset" */
39 #ifdef HAVE_STRUCT_TM_TM_GMTOFF
51 offset = ( (offset / 3600) * 100 ) + ( offset % 60 );
53 snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
54 httpdate_weekdays[t.tm_wday],
56 httpdate_months[t.tm_mon],