This strips out the newline from the asctime string and then uses a return to push the cursor back to the start of line
#include <string.h>
int main()
{
while (1) {
time_t rawtime;
char st[30];
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
sprintf (st,"%s", asctime (timeinfo));
*(index(st,'\n'))='\0';
printf("\r%s",st);
flush(stdout);
sleep(1);
}
return 0;
}