History:
TimeToStr
void TimeToStr( time_t _in_time, char *_out_str )
Converts time in miliseconds to an array in format MM:SS:MS or HH:MM:SS.
Code
void TimeToStr( time_t _in_time, char *_out_str ) { if( _in_time <= 0 ) _in_time = 0; float sec,min,ss,Smin,msec; ss = _in_time/1000; Smin = floor(ss/60); sec = floor(ss-Smin*60); min = floor((ss-floor(Smin/60)*3600)/60); msec = _in_time - ( floor(ss)*1000 ); sprintf(_out_str,"%02d:%02d.%003d",(int)min,(int)sec,(int)msec); } void TimeToStr2( time_t _in_time, char *_out_str ) { int ss = (int)_in_time; if( ss >= 0 ) { int hour = ss / 3600; int min = ss / 60 - hour*60; int sec = ss - min*60 - hour * 3600; sprintf( _out_str, "%d:%02d:%02d", hour, min, sec ); }else{ sprintf( _out_str, "-:--:--" ); } }
Code.Tode.cz by Henry - 2014