mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 23:00:42 -07:00
overlay: fps window clean up (#506)
## Link to GitHub Issue, if one exists n/a ## Description of change Use fmt library for formatting time Round down sub-second units so that the FPS counter only updates once per second (instead of Time and Uptime ticking independently) clean up usage of `localtime` in `logging.cpp`
This commit is contained in:
@@ -13,8 +13,9 @@ std::string_view log_get_datetime() {
|
||||
std::string_view log_get_datetime(std::time_t now) {
|
||||
static thread_local char buf[64];
|
||||
|
||||
// `localtime` on Windows is thread-safe
|
||||
strftime(buf, sizeof(buf), "[%Y/%m/%d %X]", localtime(&now));
|
||||
std::tm local_tm{};
|
||||
localtime_s(&local_tm, &now);
|
||||
strftime(buf, sizeof(buf), "[%Y/%m/%d %X]", &local_tm);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user