/*
 * gives time the format edif wants
 */

#include <stdio.h>
#include <time.h>

char *EdifTime()
{
int EdifMonth();
char *date;
long tim;
char day[6];
int	year;
int	nday;
int	hour;
int	minute;
int	second;
char month[6];
int	nmonth;

	time(&tim);
	date = (char *)malloc(30);
	strcpy(date, ctime(&tim));
	sscanf(date, "%s %s %d %d:%d:%d %d",
		day,month,&nday,&hour,&minute,&second,&year);
	sprintf(date, "%04d %02d %02d %02d %02d %02d",
	      	year,EdifMonth(month),nday,hour,minute,second); 
	return date;
}

int EdifMonth(month)
char *month;
{
	if (!strcmp(month, "Jan"))
		return 1;
	else if (!strcmp(month, "Feb"))
		return 2;
	else if (!strcmp(month, "Mar")) 
		return 3;
	else if (!strcmp(month, "Apr")) 
		return 4;
	else if (!strcmp(month, "May")) 
		return 5;
	else if (!strcmp(month, "Jun")) 
		return 6;
	else if (!strcmp(month, "Jul")) 
		return 7;
	else if (!strcmp(month, "Aug")) 
		return 8;
	else if (!strcmp(month, "Sep")) 
		return 9;
	else if (!strcmp(month, "Oct")) 
		return 10;
	else if (!strcmp(month, "Nov")) 
		return 11;
	else if (!strcmp(month, "Dec")) 
		return 12;
	else return 0;
}
