Use the built-in function strftime():
static char timestr[80];
char * HHMMSS ( time_t secs )
{
struct tm ts;
ts = *localtime(&secs);
strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y %Z", &ts); // "Mon May 1, 2012 hh:mm:ss zzz"
return timestr;
}