1*293Seric # include <time.h> 2*293Seric 3*293Seric /* 4*293Seric ** ARPADATE -- Create date in ARPANET format 5*293Seric ** 6*293Seric ** Parameters: 7*293Seric ** none 8*293Seric ** 9*293Seric ** Returns: 10*293Seric ** pointer to an ARPANET date field 11*293Seric ** 12*293Seric ** Side Effects: 13*293Seric ** none 14*293Seric ** 15*293Seric ** WARNING: 16*293Seric ** date is stored in a local buffer -- subsequent 17*293Seric ** calls will overwrite. 18*293Seric ** 19*293Seric ** Requires: 20*293Seric ** time (sys) 21*293Seric ** ctime (sys) 22*293Seric ** strcpy (sys) 23*293Seric ** strcat (sys) 24*293Seric ** localtime (sys) 25*293Seric ** 26*293Seric ** History: 27*293Seric ** 1/15/80 -- written. 28*293Seric */ 29*293Seric 30*293Seric arpadate() 31*293Seric { 32*293Seric register char *ud; /* the unix date */ 33*293Seric long t; 34*293Seric extern struct tm *localtime(); 35*293Seric register char *p; 36*293Seric static char b[40]; 37*293Seric 38*293Seric time(&t); 39*293Seric ud = ctime(&t); 40*293Seric 41*293Seric ud[3] = ud[7] = ud[10] = ud[19] = ud[24] = '\0'; 42*293Seric p = &ud[8]; /* 16 */ 43*293Seric if (*p == ' ') 44*293Seric p++; 45*293Seric strcpy(b, p); 46*293Seric strcat(b, " "); 47*293Seric strcat(b, &ud[4]); /* Sep */ 48*293Seric strcat(b, " "); 49*293Seric strcat(b, &ud[20]); /* 1979 */ 50*293Seric strcat(b, " "); 51*293Seric strcat(b, &ud[11]); /* 01:03:52 */ 52*293Seric if (localtime(&t)->tm_isdst) 53*293Seric strcat(b, "-PDT"); 54*293Seric else 55*293Seric strcat(b, "-PST"); 56*293Seric return (b); 57*293Seric } 58