* \defgroup HTTPDateTime Function to generate HTTP-compliant textual time/date stamp
* (This module was lifted directly from the Citadel server source)
*
+ * \ingroup WebcitHttpServer
*/
/*@{*/
#include "webcit.h"
-/** HTTP Months */
+/** HTTP Months - do not translate - these are not for human consumption */
static char *httpdate_months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-/** HTTP Weekdays */
+/** HTTP Weekdays - do not translate - these are not for human consumption */
static char *httpdate_weekdays[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
}
+void tmplput_nowstr(StrBuf *Target, WCTemplputParams *TP)
+{
+ time_t now;
+ now = time(NULL);
+ StrEscAppend(Target, NULL, asctime(localtime(&now)), 0, 0);
+}
+void tmplput_nowno(StrBuf *Target, WCTemplputParams *TP)
+{
+ time_t now;
+ now = time(NULL);
+ StrBufAppendPrintf(Target, "%ld", now);
+}
+
+void
+InitModule_DATE
+(void)
+{
+ RegisterNamespace("DATE:NOW:STR", 0, 0, tmplput_nowstr, NULL, CTX_NONE);
+ RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, NULL, CTX_NONE);
+}
+
/*@}*/