From: Francois B <mrs...@us...> - 2006-02-08 01:32:33
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8384 Added Files: format.c format.h Log Message: New function to format track time --- NEW FILE: format.c --- /*************************************************************************** * * Open Neo * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include "format.h" int format_time(unsigned char* buf, int buf_size, unsigned int time_ms,int sep_chr) { unsigned int hours; unsigned int minutes; unsigned int seconds; hours = time_ms / 3600000; //Hours minutes = (time_ms - hours*3600000) / 60000; //Minutes seconds = (time_ms - hours*3600000 - minutes*60000) / 1000; //Seconds if( !hours ) return snprintf(buf,buf_size, "%d%c%02d", minutes, sep_chr, seconds ); else return snprintf(buf,buf_size, "%d%c%02d%c%02d", hours, sep_chr, minutes, sep_chr, seconds ); } --- NEW FILE: format.h --- /*************************************************************************** * * Open Neo * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #ifndef __FORMAT_H__ #define __FORMAT_H__ int format_time(unsigned char* buf, int buf_size, unsigned int time_ms, int sep_chr); #endif |