#include "stdlib.h" #include "stdio.h" #include "string.h" #include "astring.h" char* c_i_to_s(int itime[6]) { char allmon[37]="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC\0"; char year[5],month[4],day[3],hour[3],min[3],sec[3], *ltime, *dumb; char *smon, *tmon; int i,iyr; ltime = calloc(sizeof(char),23); dumb = ltime; smon = allmon; tmon = month; i = (itime[1]-1)*3; strcpy(month, strmid(smon,i,3)); if (itime[0] > 1900) { iyr = itime[0]-1900; } else { if (itime[0] < 100) {iyr = itime[0]; } else {iyr = itime[0] - 100; } } strcpy(year, c_int_str(iyr,2)); strcpy(day, c_int_str(itime[2],2)); strcpy(hour, c_int_str(itime[3],2)); strcpy(min, c_int_str(itime[4],2)); strcpy(sec, c_int_str(itime[5],2)); strcpy(ltime,day); strcat(ltime,"-"); strcat(ltime,month); strcat(ltime,"-"); strcat(ltime,year); strcat(ltime," "); strcat(ltime,hour); strcat(ltime,":"); strcat(ltime,min); strcat(ltime,":"); strcat(ltime,sec); strcat(ltime,".000"); strcat(ltime,"\0"); return dumb; }