Screenshot function

This commit is contained in:
RipleyTom 2019-08-10 18:49:57 +02:00 committed by Megamouse
parent b3f4cd3a95
commit 87bf0386c4
7 changed files with 140 additions and 2 deletions

View file

@ -25,11 +25,20 @@ namespace date_time
return str;
}
template<char separator = 0>
static inline std::string current_time_narrow()
{
char str[80];
tm now = get_time(0);
strftime(str, sizeof(str), "%Y%m%d%H%M%S", &now);
std::string parse_buf;
if constexpr(separator != 0)
parse_buf = std::string("%Y") + separator + "%m" + separator + "%d" + separator + "%H" + separator + "%M" + separator + "%S";
else
parse_buf = "%Y%m%d%H%M%S";
strftime(str, sizeof(str), parse_buf.c_str(), &now);
return str;
}
}