Chromium Code Reviews| Index: base/logging.cc |
| diff --git a/base/logging.cc b/base/logging.cc |
| index 0771b47c182e5c18c868f1124a0784bf411d74a9..5b27507b9572ffb97cd660454644d345e3595ff7 100644 |
| --- a/base/logging.cc |
| +++ b/base/logging.cc |
| @@ -765,7 +765,9 @@ void LogMessage::Init(const char* file, int line) { |
| if (g_log_thread_id) |
| stream_ << base::PlatformThread::CurrentId() << ':'; |
| if (g_log_timestamp) { |
| - time_t t = time(nullptr); |
| + struct timespec tp = {0}; |
|
Mark Mentovai
2016/11/23 14:33:06
No need to initialize (same goes for local_time a
|
| + clock_gettime(CLOCK_REALTIME, &tp); |
|
Mark Mentovai
2016/11/23 14:33:06
Not available on WIndows! Take a look at how we so
Daniel Kurtz
2016/11/23 16:31:02
Any idea why mini_chromium already uses usec times
Daniel Kurtz
2016/11/24 03:09:53
Done.
|
| + time_t t = tp.tv_sec; |
| struct tm local_time = {0}; |
| #ifdef _MSC_VER |
| localtime_s(&local_time, &t); |
| @@ -780,6 +782,8 @@ void LogMessage::Init(const char* file, int line) { |
| << std::setw(2) << tm_time->tm_hour |
| << std::setw(2) << tm_time->tm_min |
| << std::setw(2) << tm_time->tm_sec |
| + << '.' |
| + << std::setw(6) << (tp.tv_nsec / 1000) |
| << ':'; |
| } |
| if (g_log_tickcount) |