mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 13:59:19 +02:00
Replace Now() implementation with more modern std::chrono
This commit is contained in:
@@ -35,16 +35,11 @@ bool EditorModeFlag = false;
|
|||||||
bool DebugCameraFlag = false;
|
bool DebugCameraFlag = false;
|
||||||
bool DebugTractionFlag = false;
|
bool DebugTractionFlag = false;
|
||||||
|
|
||||||
// shitty replacement for Borland timestamp function
|
|
||||||
// TODO: replace with something sensible
|
|
||||||
std::string Now()
|
std::string Now()
|
||||||
{
|
{
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
std::time_t timenow = std::time(nullptr);
|
auto local = std::chrono::current_zone()->to_local(now);
|
||||||
std::tm tm = *std::localtime(&timenow);
|
return std::format("{:%c}", local);
|
||||||
std::stringstream converter;
|
|
||||||
converter << std::put_time(&tm, "%c");
|
|
||||||
return converter.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// zwraca różnicę czasu
|
// zwraca różnicę czasu
|
||||||
|
|||||||
Reference in New Issue
Block a user