]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Thu, 22 Nov 2018 12:10:33 +0000 (07:10 -0500)
committerCristy <urban-warrior@imagemagick.org>
Thu, 22 Nov 2018 12:10:33 +0000 (07:10 -0500)
MagickCore/nt-base.c

index 86f8ffbeb820331e05fa3f22923ccd7535e1fd27..94ef4a54553c90aee34d5d3731c250589f8c2483 100644 (file)
@@ -620,9 +620,25 @@ MagickPrivate double NTElapsedTime(void)
       filetime64;
   } elapsed_time;
 
+  LARGE_INTEGER
+    performance_count;
+
+  static LARGE_INTEGER
+    frequency = { 0 };
+
   SYSTEMTIME
     system_time;
 
+  if (frequency.QuadPart == 0)
+    {
+      if (QueryPerformanceFrequency(&frequency) == 0)
+        frequency.QuadPart=1;
+    }
+  if (frequency.QuadPart > 1)
+    {
+      QueryPerformanceCounter(&performance_count);
+      return((double) performance_count.QuadPart/frequency.QuadPart);
+    }
   GetSystemTime(&system_time);
   SystemTimeToFileTime(&system_time,&elapsed_time.filetime);
   return((double) 1.0e-7*elapsed_time.filetime64);
@@ -2450,10 +2466,8 @@ MagickPrivate int NTSystemCommand(const char *command,char *output)
   CloseHandle(process_info.hProcess);
   CloseHandle(process_info.hThread);
   if (read_output != (HANDLE) NULL)
-    if (PeekNamedPipe(read_output,(LPVOID) NULL,0,(LPDWORD) NULL,&size,
-          (LPDWORD) NULL))
-      if ((size > 0) && (ReadFile(read_output,output,MagickPathExtent-1,
-          &bytes_read,NULL))) 
+    if (PeekNamedPipe(read_output,(LPVOID) NULL,0,(LPDWORD) NULL,&size,(LPDWORD) NULL))
+      if ((size > 0) && (ReadFile(read_output,output,MagickPathExtent-1,&bytes_read,NULL)))
         output[bytes_read]='\0';
   CleanupOutputHandles;
   return((int) child_status);