1293Seric # include <time.h> 2293Seric 3*403Seric static char SccsId[] = "@(#)arpadate.c 1.2 07/25/80"; 4*403Seric 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 ** Requires: 22293Seric ** time (sys) 23293Seric ** ctime (sys) 24293Seric ** strcpy (sys) 25293Seric ** strcat (sys) 26293Seric ** localtime (sys) 27293Seric ** 28293Seric ** History: 29293Seric ** 1/15/80 -- written. 30293Seric */ 31293Seric 32293Seric arpadate() 33293Seric { 34293Seric register char *ud; /* the unix date */ 35293Seric long t; 36293Seric extern struct tm *localtime(); 37293Seric register char *p; 38293Seric static char b[40]; 39293Seric 40293Seric time(&t); 41293Seric ud = ctime(&t); 42293Seric 43293Seric ud[3] = ud[7] = ud[10] = ud[19] = ud[24] = '\0'; 44293Seric p = &ud[8]; /* 16 */ 45293Seric if (*p == ' ') 46293Seric p++; 47293Seric strcpy(b, p); 48293Seric strcat(b, " "); 49293Seric strcat(b, &ud[4]); /* Sep */ 50293Seric strcat(b, " "); 51293Seric strcat(b, &ud[20]); /* 1979 */ 52293Seric strcat(b, " "); 53293Seric strcat(b, &ud[11]); /* 01:03:52 */ 54293Seric if (localtime(&t)->tm_isdst) 55293Seric strcat(b, "-PDT"); 56293Seric else 57293Seric strcat(b, "-PST"); 58293Seric return (b); 59293Seric } 60