Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / genstamp.c
index eb594119ab01eb8fc1f6adeb229aa1d6c2e15603..668e8c052192827b1d015f03d46a6ce407d394e3 100644 (file)
@@ -7,18 +7,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
+#include <time.h>
 #include "genstamp.h"
 
 
@@ -36,7 +25,7 @@ static char *weekdays[] = {
  * Supplied with a unix timestamp, generate an RFC822-compliant textual
  * time and date stamp.
  */
-void datestring(char *buf, size_t n, time_t xtime, int which_format) {
+long datestring(char *buf, size_t n, time_t xtime, int which_format) {
        struct tm t;
 
        long offset;
@@ -62,7 +51,9 @@ void datestring(char *buf, size_t n, time_t xtime, int which_format) {
        switch(which_format) {
 
                case DATESTRING_RFC822:
-                       snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
+                       return snprintf(
+                               buf, n,
+                               "%s, %02d %s %04d %02d:%02d:%02d %c%04ld",
                                weekdays[t.tm_wday],
                                t.tm_mday,
                                months[t.tm_mon],
@@ -75,7 +66,9 @@ void datestring(char *buf, size_t n, time_t xtime, int which_format) {
                break;
 
                case DATESTRING_IMAP:
-                       snprintf(buf, n, "%02d-%s-%04d %02d:%02d:%02d %c%04ld",
+                       return snprintf(
+                               buf, n,
+                               "%02d-%s-%04d %02d:%02d:%02d %c%04ld",
                                t.tm_mday,
                                months[t.tm_mon],
                                t.tm_year + 1900,
@@ -87,4 +80,5 @@ void datestring(char *buf, size_t n, time_t xtime, int which_format) {
                break;
 
        }
+       return 0;
 }