/*

$Id: time822,v 1.4 2000/02/08 23:53:45 joseph Exp $

*/

#include "swis.h"
#include "time822.h"

static const char time822_months[12][4] = {
	"Jan", "Feb", "Mar", "Apr", "May", "Jun",
	"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

static const char time822_days[7][4] = {
	"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};

/* Prints time to a file */
void time822_fprint(FILE *fp, time_t t)
{
  int zone;
  struct tm *st;

  st = localtime(&t);
  _swix(Territory_ReadCurrentTimeZone, _OUT(1), &zone);
  fprintf(fp, "%s, %02d %s %04d %02d:%02d:%02d %c%04d",
  	time822_days[st->tm_wday], st->tm_mday,
        time822_months[st->tm_mon], 1900+st->tm_year,
  	st->tm_hour, st->tm_min, st->tm_sec,
  	zone >= 0 ? '+' : '-', zone / 360000);
}
