17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 23:09:20 +02:00

refactor: sonar c++20 changes

This commit is contained in:
jerrrrycho
2026-09-27 19:04:23 +02:00
parent 8fbb482350
commit c0bea5e611
18 changed files with 111 additions and 106 deletions

View File

@@ -426,6 +426,28 @@ std::time_t last_modified(std::string const &Filename)
return 0;
}
std::tm local_tm(std::time_t Time)
{
std::tm tm{};
#ifdef _WIN32
localtime_s(&tm, &Time);
#else
localtime_r(&Time, &tm);
#endif
return tm;
}
std::tm utc_tm(std::time_t Time)
{
std::tm tm{};
#ifdef _WIN32
gmtime_s(&tm, &Time);
#else
gmtime_r(&Time, &tm);
#endif
return tm;
}
// potentially erases file extension from provided file name. returns: true if extension was removed, false otherwise
bool erase_extension(std::string &Filename)
{