1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

extra function: getFormattedDateTime

This commit is contained in:
Michael
2023-08-12 01:13:03 +02:00
committed by GitHub
parent 4d507f3d8a
commit 52f00ec308
6 changed files with 41 additions and 6 deletions

View File

@@ -10,6 +10,8 @@
#include "StdInc.h"
#include "CMapInfo.h"
#include <vstd/DateUtils.h>
#include "../filesystem/ResourceID.h"
#include "../StartInfo.h"
#include "../GameConstants.h"
@@ -62,12 +64,7 @@ void CMapInfo::saveInit(const ResourceID & file)
fullFileURI = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(file)).string();
countPlayers();
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(file));
std::tm tm = *std::localtime(&time);
std::stringstream s;
s.imbue(std::locale(""));
s << std::put_time(&tm, "%x %X");
date = s.str();
date = vstd::getFormattedDateTime(time);
// We absolutely not need this data for lobby and server will read it from save
// FIXME: actually we don't want them in CMapHeader!