From 79c82714295c4646dac36d1e8a05f03183d440a3 Mon Sep 17 00:00:00 2001 From: flowtron Date: Sat, 5 Feb 2011 14:35:59 +0000 Subject: [PATCH] really use the time the server provided; as GMT or localtime. git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6068 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- docs/reference.xml | 5 +++++ source/src/clients2c.cpp | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/reference.xml b/docs/reference.xml index 3a1c6821..fc6ebcbd 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -5246,6 +5246,11 @@ Output: + + use localtime (1) or GMT (0)? + + + make dead players instantly pop out of existence, instead of falling over and sinking into the ground. diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index bcb3d61c..e4d83386 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -1309,7 +1309,7 @@ void setDemoTimestampFormat(char *fmt) } else copystring(demofilenameformat, DEFDEMOTIMEFMT); // reset to default if passed empty string - or should we output the current value in this case? } COMMANDN(demotimeformat, setDemoTimestampFormat, ARG_1STR); - +VARP(demotimelocal, 0, 0, 1); void getdemonameformat() { result(demofilenameformat); } COMMAND(getdemonameformat, ARG_NONE); void getdemotimeformat() { result(demotimestampformat); } COMMAND(getdemotimeformat, ARG_NONE); @@ -1346,7 +1346,14 @@ const char *getDemoFilename(int gmode, int mplay, int mdrop, int tstamp, char *s case 'n': formatstring(cfspp)("%s", srvmap); break; case 's': formatstring(cfspp)("%d", mdrop); break; case 'S': formatstring(cfspp)("%d", mplay); break; - case 'w': formatstring(cfspp)("%s", timestring(true, demotimestampformat)); break; + case 'w': + { + time_t t = tstamp; + struct tm * timeinfo; + timeinfo = demotimelocal ? localtime(&t) : gmtime (&t); + strftime(cfspp, sizeof(string) - 1, demotimestampformat, timeinfo); + break; + } default: conoutf("bad formatstring: demonameformat @ %d", cc); cc-=1; break; // don't drop the bad char } defformatstring(fsbuf)("%s%s", dmofn, cfspp);