From e9205071345871d52905085a6d5bb57ae2a9193a Mon Sep 17 00:00:00 2001 From: Buginator Date: Sat, 21 Feb 2009 22:24:02 +0000 Subject: [PATCH] Change debug() output from gametime to real time. In MP games, since gametime can vary so much between machines, needed a more reliable time source to sync up messages between them. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6679 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/framework/debug.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/framework/debug.c b/lib/framework/debug.c index ce214497a..335322170 100644 --- a/lib/framework/debug.c +++ b/lib/framework/debug.c @@ -28,7 +28,7 @@ #include #include - +#include #include "frameint.h" #include "string_ext.h" @@ -371,8 +371,16 @@ void _debug( code_part part, const char *function, const char *str, ... ) if (!repeated) { + time_t rawtime; + struct tm * timeinfo; + char ourtime[15]; //HH:MM:SS + + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); + strftime (ourtime,15,"%I:%M:%S",timeinfo); + // Assemble the outputBuffer: - ssprintf(outputBuffer, "%-8s|%012u: %s", code_part_names[part], gameTime, useInputBuffer1 ? inputBuffer[1] : inputBuffer[0]); + ssprintf(outputBuffer, "%-8s|%s: %s", code_part_names[part], ourtime, useInputBuffer1 ? inputBuffer[1] : inputBuffer[0]); printToDebugCallbacks(outputBuffer); }