[osiris-devel] time conversion
Brian Wotring
brian at shmoo.com
Sat Feb 19 18:17:13 EST 2005
Anyone have a problem with this? The goal is to make this date header
compliant with RFC 2822 as people have been randomly bringing it to my
attention:
char * osi_time_to_string( long time )
{
static char buf[40];
time_t curtime;
struct tm *loc;
curtime = time;
loc = localtime( &curtime );
/* based on RFC 2822 it should be:
3.3. Date and Time Specification
...
date-time = [ day-of-week "," ] date FWS time [CFWS]
...
*/
strftime( buf, sizeof(buf) ,"%a, %e %b %Y %H:%M:%S %z\n", loc );
buf[39] = '\0';
return buf;
}
More information about the osiris-devel
mailing list