aaltay commented on a change in pull request #12172:
URL: https://github.com/apache/beam/pull/12172#discussion_r455238115



##########
File path: sdks/python/apache_beam/runners/worker/crossplatform_time.h
##########
@@ -26,24 +26,32 @@
 
 /**
  * Alternative to POSIX clock_gettime that may be run on Windows platform. The 
clk_id parameter is
- * ignored, and function always act as for CLOCK_MONOTONIC. Windows 
performance counter is used.
+ * ignored and function act as for CLOCK_MONOTONIC. On Windows XP or later 
Performance Counter is used.
+ * On older platforms, where there's no Performance Counter, SystemTime will 
be used as a failover.
  */
 int clock_gettime(int clk_id, struct timespec *tv) {
     static LARGE_INTEGER counterFrequency = {0};
-    LARGE_INTEGER counterValue;
+    static BOOL performanceCounterAvailable = TRUE;
+    LARGE_INTEGER counterValue = {0};
 
-    if (0 == counterFrequency.QuadPart) {
+    //initialization
+    if (0 == counterFrequency.QuadPart && performanceCounterAvailable) {

Review comment:
       nit:
   
   This part `if (0 == counterFrequency.QuadPart && 
performanceCounterAvailable)` could be simplified to `if (0 == 
counterFrequency.QuadPart)` because `counterFrequency.QuadPart` will be set to 
a non-zero value either way after the first query.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to