Changing the name of the 'Aide' access level to 'Admin'
[citadel.git] / webcit / http_datestring.c
index f3db04ce9783427b1d5ed8060121eebb37b4e389..33158dca92e20d1a9f48d54373a21bb597c4b48e 100644 (file)
@@ -1,13 +1,3 @@
-/*
- * $Id$
- */
-/**
- * \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 - do not translate - these are not for human consumption */
@@ -66,9 +56,22 @@ void http_datestring(char *buf, size_t n, time_t xtime) {
 
 void tmplput_nowstr(StrBuf *Target, WCTemplputParams *TP)
 {
+       char buf[64];
+       long bufused;
        time_t now;
+       
        now = time(NULL);
-       StrEscAppend(Target, NULL, asctime(localtime(&now)), 0, 0);
+#ifdef HAVE_SOLARIS_LOCALTIME_R
+       asctime_r(localtime(&now), buf, sizeof(buf));
+#else
+       asctime_r(localtime(&now), buf);
+#endif
+       bufused = strlen(buf);
+       if ((bufused > 0) && (buf[bufused - 1] == '\n')) {
+               buf[bufused - 1] = '\0';
+               bufused --;
+       }
+       StrEscAppend(Target, NULL, buf, 0, 0);
 }
 void tmplput_nowno(StrBuf *Target, WCTemplputParams *TP)
 {
@@ -81,8 +84,6 @@ void
 InitModule_DATE
 (void)
 {
-       RegisterNamespace("DATE:NOW:STR", 0, 0, tmplput_nowstr, CTX_NONE);
-       RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, CTX_NONE);
+       RegisterNamespace("DATE:NOW:STR", 0, 0, tmplput_nowstr, NULL, CTX_NONE);
+       RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, NULL, CTX_NONE);
 }
-
-/*@}*/