http://www.ousob.com --- Legacy Redefined #include <stdlib.h> #include <dos.h> #include <extend50.h> char *p_hour, *p_min, *p_sec; void xunpacktime(int *sec, int *min, int *hour, int num); CLIPPER b_ftime() { char clp_data_fmt[9]; char buffer1[20]; char buffer2[20]; char buffer3[20]; int h,m,s; int notfound, radix = 10; unsigned temp; struct find_t file_info; if( !ISCHAR(1) ){ _retc(clp_data_fmt); return; } notfound = _dos_findfirst(_parc(1), _A_NORMAL, &file_info); if( notfound ){ _retc(clp_data_fmt); return; } temp = file_info.wr_time; xunpacktime(&s, &m, &h, temp); p_hour = itoa(h, buffer1, radix); p_min = itoa(m, buffer2, radix); p_sec = itoa(s, buffer3, radix); if( h == 0 ){ clp_data_fmt[0] = '0'; clp_data_fmt[1] = '0'; } if( (h > 0) && (h < 10) ){ clp_data_fmt[0] = '0'; clp_data_fmt[1] = p_hour[0]; } if( (h >= 10) && (h <=23) ){ clp_data_fmt[0] = p_hour[0]; clp_data_fmt[1] = p_hour[1]; } clp_data_fmt[2] = ':'; if( m == 0 ){ clp_data_fmt[3] = '0'; clp_data_fmt[4] = '0'; } if( (m > 0) && (m < 10) ){ clp_data_fmt[3] = '0'; clp_data_fmt[4] = p_min[0]; } if( (m >= 10) && (m <= 59) ){ clp_data_fmt[3] = p_min[0]; clp_data_fmt[4] = p_min[1]; } clp_data_fmt[5] = ':'; if( s == 0 ){ clp_data_fmt[6] = '0'; clp_data_fmt[7] = '0'; } if( (s > 0) && (s < 10) ){ clp_data_fmt[6] = '0'; clp_data_fmt[7] = p_sec[0]; } if( (s >= 10) && (s <= 59) ){ clp_data_fmt[6] = p_sec[0]; clp_data_fmt[7] = p_sec[1]; } clp_data_fmt[8] = NULL; _retc(clp_data_fmt); } void xunpacktime(int *sec, int *min, int *hour, int num) { *sec = (num & 0x1f) * 2; *min = (num & 0x7e0) >> 0x05; *hour = (num & 0xf800) >> 0x0b; }