diff options
| author | xalduin <xalduin@gmail.com> | 2010-06-03 16:24:31 -0400 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-06-03 22:32:42 +0200 |
| commit | a563c2f322bb62437149552ab17f965c9922daf6 (patch) | |
| tree | b05c7350fa0b1ed280b1603df991f98719e426f1 | |
| parent | 67d4903b9fe4355c8ddaa771fa4db5d6a80d17c9 (diff) | |
| download | zcatch-a563c2f322bb62437149552ab17f965c9922daf6.tar.gz zcatch-a563c2f322bb62437149552ab17f965c9922daf6.zip | |
Issue #82 time and date in screenshot filename
| -rw-r--r-- | src/engine/client/graphics.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp index 667ba213..e2f4ae4c 100644 --- a/src/engine/client/graphics.cpp +++ b/src/engine/client/graphics.cpp @@ -27,6 +27,7 @@ #include <engine/keys.h> #include <math.h> +#include <time.h> #include "graphics.h" @@ -868,10 +869,17 @@ void CGraphics_SDL::Swap() char aFilename[128]; static int Index = 1; + time_t Time; + char aDate[20]; + + time(&Time); + tm* TimeInfo = localtime(&Time); + strftime(aDate, sizeof(aDate), "%Y-%m-%d_%I-%M", TimeInfo); + for(; Index < 10000; Index++) { IOHANDLE io; - str_format(aFilename, sizeof(aFilename), "screenshots/screenshot%05d.png", Index); + str_format(aFilename, sizeof(aFilename), "screenshots/screenshot%s-%05d.png", aDate, Index); io = m_pStorage->OpenFile(aFilename, IOFLAG_READ); if(io) io_close(io); |