1293Seric # include <time.h>
2293Seric 
3*1586Seric static char SccsId[] = "@(#)arpadate.c	1.4	10/21/80";
4403Seric 
5293Seric /*
6293Seric **  ARPADATE -- Create date in ARPANET format
7293Seric **
8293Seric **	Parameters:
9293Seric **		none
10293Seric **
11293Seric **	Returns:
12293Seric **		pointer to an ARPANET date field
13293Seric **
14293Seric **	Side Effects:
15293Seric **		none
16293Seric **
17293Seric **	WARNING:
18293Seric **		date is stored in a local buffer -- subsequent
19293Seric **		calls will overwrite.
20293Seric */
21293Seric 
22*1586Seric char *
23293Seric arpadate()
24293Seric {
25293Seric 	register char *ud;	/* the unix date */
26293Seric 	long t;
27293Seric 	extern struct tm *localtime();
28293Seric 	register char *p;
29293Seric 	static char b[40];
30*1586Seric 	extern char *ctime();
31293Seric 
32293Seric 	time(&t);
33293Seric 	ud = ctime(&t);
34293Seric 
35293Seric 	ud[3] = ud[7] = ud[10] = ud[19] = ud[24] = '\0';
36293Seric 	p = &ud[8];		/* 16 */
37293Seric 	if (*p == ' ')
38293Seric 		p++;
39293Seric 	strcpy(b, p);
40293Seric 	strcat(b, " ");
41293Seric 	strcat(b, &ud[4]);	/* Sep */
42293Seric 	strcat(b, " ");
43293Seric 	strcat(b, &ud[20]);	/* 1979 */
44293Seric 	strcat(b, " ");
45293Seric 	strcat(b, &ud[11]);	/* 01:03:52 */
46293Seric 	if (localtime(&t)->tm_isdst)
47293Seric 		strcat(b, "-PDT");
48293Seric 	else
49293Seric 		strcat(b, "-PST");
50293Seric 	return (b);
51293Seric }
52