diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc index 798c059fb3..4bc9183d97 100644 --- a/rtc_base/logging.cc +++ b/rtc_base/logging.cc @@ -138,9 +138,10 @@ LogMessage::LogMessage(const char* file, int err) { log_line_.set_severity(sev); if (log_timestamp_) { + int64_t log_start_time = LogStartTime(); // Use SystemTimeMillis so that even if tests use fake clocks, the timestamp // in log messages represents the real system time. - int64_t time = TimeDiff(SystemTimeMillis(), LogStartTime()); + int64_t time = TimeDiff(SystemTimeMillis(), log_start_time); // Also ensure WallClockStartTime is initialized, so that it matches // LogStartTime. WallClockStartTime();