Some consolidation.

This commit is contained in:
n-a-c-h
2005-10-10 00:18:18 +00:00
parent 3226c5115d
commit 5163b9b35e

View File

@@ -298,25 +298,11 @@ void zstart ()
asm_call(init); asm_call(init);
} }
static char *int_to_asc(size_t number) static char *seconds_to_asc(unsigned int seconds)
{
static char buffer[12];
char *i;
buffer[19] = '\0';
i = buffer+18;
do
{
*i-- = (char)(number % 10) + '0';
} while (number /= 10);
return(++i);
}
char *seconds_to_asc(size_t seconds)
{ {
static char buffer[50]; static char buffer[50];
size_t hours, minutes; char *p = buffer;
unsigned int hours, minutes;
hours = seconds/3600; hours = seconds/3600;
seconds -= hours*3600; seconds -= hours*3600;
@@ -326,18 +312,18 @@ char *seconds_to_asc(size_t seconds)
if (hours) if (hours)
{ {
strcat(buffer, int_to_asc(hours)); sprintf(p, "%u hours ", hours);
strcat(buffer, " hours "); p += strlen(p);
} }
if (minutes) if (minutes)
{ {
strcat(buffer, int_to_asc(minutes)); sprintf(p, "%u min ", minutes);
strcat(buffer, " min "); p += strlen(p);
} }
if (seconds) if (seconds)
{ {
strcat(buffer, int_to_asc(seconds)); sprintf(p, "%u sec", seconds);
strcat(buffer, " sec"); p += strlen(p);
} }
if (!*buffer) if (!*buffer)
{ {