include abbreviated uptime in stat row

This commit is contained in:
ehouse 2009-07-16 02:56:25 +00:00
parent c5e73fd725
commit 8a0d963c95
2 changed files with 7 additions and 15 deletions

View file

@ -360,7 +360,7 @@ format_uptime( char* buf, int len )
seconds %= 60; seconds %= 60;
snprintf( buf, len, snprintf( buf, len,
"uptime: %d days, %d hours, %d minutes, %ld seconds", "uptime: %d D, %d H, %d M, %ld S",
days, hours, minutes, seconds ); days, hours, minutes, seconds );
} }

View file

@ -95,16 +95,6 @@ send_meta( FILE* fil )
fprintf( fil, "</head>" ); fprintf( fil, "</head>" );
} }
static void
printUptime( FILE* fil )
{
char buf[128];
fprintf( fil, "<div class=\"header\">Uptime</div>" );
format_uptime( buf, sizeof(buf) );
fprintf( fil, "<p>%s</p>", buf );
}
static void static void
printTail( FILE* fil ) printTail( FILE* fil )
{ {
@ -163,10 +153,14 @@ printStats( FILE* fil )
CRefMgr* cmgr = CRefMgr::Get(); CRefMgr* cmgr = CRefMgr::Get();
int nGames = cmgr->GetNumGamesSeen(); int nGames = cmgr->GetNumGamesSeen();
int siz = cmgr->GetSize(); int siz = cmgr->GetSize();
char uptime[64];
format_uptime( uptime, sizeof(uptime) );
fprintf( fil, "<div class=\"header\">Stats</div>" ); fprintf( fil, "<div class=\"header\">Stats</div>" );
fprintf( fil, "<table>" ); fprintf( fil, "<table>" );
fprintf( fil, "<tr><th>Games played</th><th>Games in play</th></tr>" ); fprintf( fil, "<tr><th>Games played</th><th>Games in play</th>"
fprintf( fil, "<tr><td>%d</td><td>%d</td></tr>\n", nGames, siz ); "<th>Uptime</th></tr>" );
fprintf( fil, "<tr><td>%d</td><td>%d</td><td>%s</td></tr>\n",
nGames, siz, uptime );
fprintf( fil, "</table>" ); fprintf( fil, "</table>" );
} }
@ -200,8 +194,6 @@ http_thread_main( void* arg )
printCrefs( fil ); printCrefs( fil );
printUptime( fil );
printTail( fil ); printTail( fil );
fprintf( fil, "</div></body></html>" ); fprintf( fil, "</div></body></html>" );