Back to index

courier  0.68.2
Functions | Variables
rfc822_mkdate.c File Reference
#include "rfc822.h"
#include <sys/types.h>
#include <time.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Functions

void rfc822_mkdate_buf (time_t t, char *buf)
const char * rfc822_mkdate (time_t t)

Variables

static const char *const months []
static const char *const wdays []

Function Documentation

const char* rfc822_mkdate ( time_t  t)

Definition at line 106 of file rfc822_mkdate.c.

{
static char buf[50];

       rfc822_mkdate_buf(t, buf);
       return (buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rfc822_mkdate_buf ( time_t  t,
char *  buf 
)

Definition at line 42 of file rfc822_mkdate.c.

{
struct tm *p;
int    offset;

#if    USE_TIME_ALTZONE

       p=localtime(&t);
       offset= -(int)timezone;

       if (p->tm_isdst > 0)
              offset= -(int)altzone;

       if (offset % 60)
       {
              offset=0;
              p=gmtime(&t);
       }
       offset /= 60;
#else
#if    USE_TIME_DAYLIGHT

       p=localtime(&t);
       offset= -(int)timezone;

       if (p->tm_isdst > 0)
              offset += 60*60;
       if (offset % 60)
       {
              offset=0;
              p=gmtime(&t);
       }
       offset /= 60;
#else
#if    USE_TIME_GMTOFF
       p=localtime(&t);
       offset= p->tm_gmtoff;

       if (offset % 60)
       {
              offset=0;
              p=gmtime(&t);
       }
       offset /= 60;
#else
       p=gmtime(&t);
       offset=0;
#endif
#endif
#endif

       offset = (offset % 60) + offset / 60 * 100;

       sprintf(buf, "%s, %02d %s %04d %02d:%02d:%02d %+05d",
              wdays[p->tm_wday],
              p->tm_mday,
              months[p->tm_mon],
              p->tm_year+1900,
              p->tm_hour,
              p->tm_min,
              p->tm_sec,
              offset);
}

Here is the caller graph for this function:


Variable Documentation

const char* const months[] [static]
Initial value:
{
       "Jan",
       "Feb",
       "Mar",
       "Apr",
       "May",
       "Jun",
       "Jul",
       "Aug",
       "Sep",
       "Oct",
       "Nov",
       "Dec"}

Definition at line 19 of file rfc822_mkdate.c.

const char* const wdays[] [static]
Initial value:
{
       "Sun",
       "Mon",
       "Tue",
       "Wed",
       "Thu",
       "Fri",
       "Sat"}

Definition at line 33 of file rfc822_mkdate.c.