|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflmime.h" char * encode_mime_time (long date, long time)
Encode date and time (in long format) in Mime RFC1123 date format, e.g. Mon, 12 Jan 1995 12:05:01 GMT. The supplied date and time are in local time. Returns the date/time string if the date was legal, else returns "?". Returned string is in a static buffer.
{
int
day_week, /* Day of week number (0 is sunday) */
month; /* Month number */
static char
buffer [50];
local to gmt (date, time, &date, &time);
day_week = day of week (date);
month = GET_MONTH (date);
if (day_week >= 0 && day_week < 7 && month > 0 && month < 13)
{
snprintf (buffer, sizeof (buffer),
"%s, %02d %s %04d %02d:%02d:%02d GMT",
days [day_week],
GET_DAY (date),
months [month - 1],
GET_CCYEAR (date),
GET_HOUR (time),
GET_MINUTE (time),
GET_SECOND (time)
);
return (buffer);
}
else
return ("?");
}
| | << | < | > | >> |
|