mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 11:11:33 +00:00
Merge branch 'fix_log_time' into 'master'
Use system_clock for time in logs (#6711) Closes #6711 See merge request OpenMW/openmw!1791
This commit is contained in:
commit
ddd01ac777
2 changed files with 5 additions and 4 deletions
|
@ -112,6 +112,7 @@
|
||||||
Bug #6670: Dialogue order is incorrect
|
Bug #6670: Dialogue order is incorrect
|
||||||
Bug #6680: object.cpp handles nodetree unsafely, memory access with dangling pointer
|
Bug #6680: object.cpp handles nodetree unsafely, memory access with dangling pointer
|
||||||
Bug #6682: HitOnMe doesn't fire as intended
|
Bug #6682: HitOnMe doesn't fire as intended
|
||||||
|
Bug #6711: Log time differs from real time
|
||||||
Feature #890: OpenMW-CS: Column filtering
|
Feature #890: OpenMW-CS: Column filtering
|
||||||
Feature #1465: "Reset" argument for AI functions
|
Feature #1465: "Reset" argument for AI functions
|
||||||
Feature #2491: Ability to make OpenMW "portable"
|
Feature #2491: Ability to make OpenMW "portable"
|
||||||
|
|
|
@ -78,11 +78,11 @@ namespace Debug
|
||||||
int prefixSize;
|
int prefixSize;
|
||||||
{
|
{
|
||||||
prefix[0] = '[';
|
prefix[0] = '[';
|
||||||
uint64_t ms = std::chrono::duration_cast<std::chrono::milliseconds>(
|
const auto now = std::chrono::system_clock::now();
|
||||||
std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
const auto time = std::chrono::system_clock::to_time_t(now);
|
||||||
std::time_t t = ms / 1000;
|
prefixSize = std::strftime(prefix + 1, sizeof(prefix) - 1, "%T", std::localtime(&time)) + 1;
|
||||||
prefixSize = std::strftime(prefix + 1, sizeof(prefix) - 1, "%T", std::localtime(&t)) + 1;
|
|
||||||
char levelLetter = " EWIVD*"[int(level)];
|
char levelLetter = " EWIVD*"[int(level)];
|
||||||
|
const auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
|
||||||
prefixSize += snprintf(prefix + prefixSize, sizeof(prefix) - prefixSize,
|
prefixSize += snprintf(prefix + prefixSize, sizeof(prefix) - prefixSize,
|
||||||
".%03u %c] ", static_cast<unsigned>(ms % 1000), levelLetter);
|
".%03u %c] ", static_cast<unsigned>(ms % 1000), levelLetter);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue