X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fgenstamp.c;h=e8d5dd86bc3f3b4c4c3a64168e4bc00add8b8d9b;hb=HEAD;hp=8915afa88ee6e5befa9845053915a6de3767a751;hpb=09d82e2621017aca1ae107d0dc9d57a7820f56b1;p=citadel.git diff --git a/citadel/genstamp.c b/citadel/genstamp.c deleted file mode 100644 index 8915afa88..000000000 --- a/citadel/genstamp.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id$ - * - * Function to generate RFC822-compliant textual time/date stamp - * - */ - -#ifdef DLL_EXPORT -#define IN_LIBCIT -#endif - -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include "genstamp.h" - - -static char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; - -static char *weekdays[] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; - - -/* - * Supplied with a unix timestamp, generate an RFC822-compliant textual - * time and date stamp. - */ -void datestring(char *buf, time_t xtime, int which_format) { - struct tm *t; - - long offset; - char offsign; - - t = localtime(&xtime); - - /* Convert "seconds west of GMT" to "hours/minutes offset" */ - offset = t->tm_gmtoff; - if (offset > 0) { - offsign = '-'; - } - else { - offset = 0L - offset; - offsign = '+'; - } - offset = ( (offset / 3600) * 100 ) + ( offset % 60 ); - - switch(which_format) { - - case DATESTRING_RFC822: - sprintf(buf, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld", - weekdays[t->tm_wday], - t->tm_mday, - months[t->tm_mon], - t->tm_year + 1900, - t->tm_hour, - t->tm_min, - t->tm_sec, - offsign, offset - ); - break; - - case DATESTRING_IMAP: - sprintf(buf, "%02d-%s-%04d %02d:%02d:%02d %c%04ld", - t->tm_mday, - months[t->tm_mon], - t->tm_year + 1900, - t->tm_hour, - t->tm_min, - t->tm_sec, - offsign, offset - ); - break; - - } -} -