Fixes issue #97

This commit is contained in:
dingusdev 2024-06-30 06:53:44 -07:00
parent 5eaff7a8ce
commit 17cdcc5560
2 changed files with 6 additions and 6 deletions

View File

@ -327,7 +327,7 @@ void ppc_main_opcode()
OpcodeGrabber[(ppc_cur_instruction >> 26) & 0x3F](); OpcodeGrabber[(ppc_cur_instruction >> 26) & 0x3F]();
} }
long long now_ns() { long long cpu_now_ns() {
#ifdef __APPLE__ #ifdef __APPLE__
return ConvertHostTimeToNanos2(mach_absolute_time()); return ConvertHostTimeToNanos2(mach_absolute_time());
#else #else
@ -339,7 +339,7 @@ long long now_ns() {
uint64_t get_virt_time_ns() uint64_t get_virt_time_ns()
{ {
if (g_realtime) { if (g_realtime) {
return now_ns() - g_nanoseconds_base; return cpu_now_ns() - g_nanoseconds_base;
} else { } else {
return g_icycles << icnt_factor; return g_icycles << icnt_factor;
} }
@ -898,7 +898,7 @@ void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool include_601,
#ifdef __APPLE__ #ifdef __APPLE__
mach_timebase_info(&timebase_info); mach_timebase_info(&timebase_info);
#endif #endif
g_nanoseconds_base = now_ns(); g_nanoseconds_base = cpu_now_ns();
g_icycles_base = 0; g_icycles_base = 0;
g_icycles = 0; g_icycles = 0;
//icnt_factor = 6; //icnt_factor = 6;

View File

@ -515,7 +515,7 @@ namespace loguru
argv[argc] = nullptr; argv[argc] = nullptr;
} }
static long long now_ns() static long long loguru_now_ns()
{ {
return duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count(); return duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count();
} }
@ -1578,7 +1578,7 @@ namespace loguru
} }
} }
#if LOGURU_VERBOSE_SCOPE_ENDINGS #if LOGURU_VERBOSE_SCOPE_ENDINGS
auto duration_sec = static_cast<double>(now_ns() - _start_time_ns) / 1e9; auto duration_sec = static_cast<double>(loguru_now_ns() - _start_time_ns) / 1e9;
#if LOGURU_USE_FMTLIB #if LOGURU_USE_FMTLIB
auto buff = textprintf("{:.{}f} s: {:s}", duration_sec, LOGURU_SCOPE_TIME_PRECISION, _name); auto buff = textprintf("{:.{}f} s: {:s}", duration_sec, LOGURU_SCOPE_TIME_PRECISION, _name);
#else #else
@ -1596,7 +1596,7 @@ namespace loguru
if (_verbosity <= current_verbosity_cutoff()) { if (_verbosity <= current_verbosity_cutoff()) {
std::lock_guard<std::recursive_mutex> lock(s_mutex); std::lock_guard<std::recursive_mutex> lock(s_mutex);
_indent_stderr = (_verbosity <= g_stderr_verbosity); _indent_stderr = (_verbosity <= g_stderr_verbosity);
_start_time_ns = now_ns(); _start_time_ns = loguru_now_ns();
vsnprintf(_name, sizeof(_name), format, vlist); vsnprintf(_name, sizeof(_name), format, vlist);
log_to_everywhere(1, _verbosity, _file, _line, "{ ", _name); log_to_everywhere(1, _verbosity, _file, _line, "{ ", _name);