[libcxx] r290805 - chrono: address post-commit comments from majnemer

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 1 14:04:36 PST 2017


Author: compnerd
Date: Sun Jan  1 16:04:36 2017
New Revision: 290805

URL: http://llvm.org/viewvc/llvm-project?rev=290805&view=rev
Log:
chrono: address post-commit comments from majnemer

Correct style to match libc++ style as pointed out by David Majnemer on
IRC.  NFC.

Modified:
    libcxx/trunk/src/chrono.cpp

Modified: libcxx/trunk/src/chrono.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/chrono.cpp?rev=290805&r1=290804&r2=290805&view=diff
==============================================================================
--- libcxx/trunk/src/chrono.cpp (original)
+++ libcxx/trunk/src/chrono.cpp Sun Jan  1 16:04:36 2017
@@ -160,14 +160,14 @@ steady_clock::now() _NOEXCEPT
 steady_clock::time_point
 steady_clock::now() _NOEXCEPT
 {
-  static LARGE_INTEGER liFreq;
-  static BOOL bQPFRun = FALSE;
-  if (bQPFRun == FALSE)
-    bQPFRun = QueryPerformanceFrequency(&liFreq);
+  static LARGE_INTEGER freq;
+  static BOOL initialized = FALSE;
+  if (!initialized)
+    initialized = QueryPerformanceFrequency(&freq); // always succceeds
 
-  LARGE_INTEGER liCntr;
-  QueryPerformanceCounter(&liCntr);
-  return time_point(duration(liCntr.QuadPart * nano::den / liFreq.QuadPart));
+  LARGE_INTEGER counter;
+  QueryPerformanceCounter(&counter);
+  return time_point(duration(counter.QuadPart * nano::den / freq.QuadPart));
 }
 
 #elif defined(CLOCK_MONOTONIC)




More information about the cfe-commits mailing list