mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Issue #82 time and date in screenshot filename
This commit is contained in:
parent
67d4903b9f
commit
a563c2f322
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue