* move some more vars from the session context to strbuf (the use of StrBufAppendTemp...
[citadel.git] / webcit / http_datestring.c
index 33f57846414fbcc6a3cd4101fa0f70d2a09f7643..f3db04ce9783427b1d5ed8060121eebb37b4e389 100644 (file)
@@ -64,4 +64,25 @@ void http_datestring(char *buf, size_t n, time_t xtime) {
 }
 
 
+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, CTX_NONE);
+       RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, CTX_NONE);
+}
+
 /*@}*/