Files
vcmi/include/vstd/DateUtils.h
T

25 lines
393 B
C++
Raw Normal View History

2023-08-12 01:13:03 +02:00
#pragma once
VCMI_LIB_NAMESPACE_BEGIN
namespace vstd
{
2023-12-16 19:54:45 +01:00
DLL_LINKAGE std::string getFormattedDateTime(std::time_t dt, std::string format);
2023-08-23 01:47:55 +02:00
DLL_LINKAGE std::string getDateTimeISO8601Basic(std::time_t dt);
2023-08-12 01:13:03 +02:00
2026-06-17 13:18:09 +03:00
inline std::tm safeLocalTime(std::time_t dt)
{
std::tm tm{};
#ifdef _WIN32
localtime_s(&tm, &dt);
#else
localtime_r(&dt, &tm);
#endif
return tm;
}
2023-08-12 01:13:03 +02:00
}
VCMI_LIB_NAMESPACE_END