Procházet zdrojové kódy

Fix StopTime to also account for localtime being a day ahead of gmtime

Zach Mullen před 16 roky
rodič
revize
9eea95c90f
2 změnil soubory, kde provedl 10 přidání a 8 odebrání
  1. 5 4
      Source/CTest/cmCTestRunTest.cxx
  2. 5 4
      Source/cmCTest.cxx

+ 5 - 4
Source/CTest/cmCTestRunTest.cxx

@@ -535,15 +535,16 @@ double cmCTestRunTest::ResolveTimeout()
   lctime = localtime(&current_time);
   int local_hour = lctime->tm_hour;
 
-  int tzone_offset = 0;
+  int tzone_offset = local_hour - gm_hour;
   if(gm_time > current_time && gm_hour < local_hour)
     {
     // this means gm_time is on the next day
-    tzone_offset = local_hour - gm_hour - 24;
+    tzone_offset -= 24;
     }
-  else
+  else if(gm_time < current_time && gm_hour > local_hour)
     {
-    tzone_offset = local_hour - gm_hour;
+    // this means gm_time is on the previous day
+    tzone_offset += 24;
     }
 
   tzone_offset *= 100;

+ 5 - 4
Source/cmCTest.cxx

@@ -2561,15 +2561,16 @@ void cmCTest::DetermineNextDayStop()
   lctime = localtime(&current_time);
   int local_hour = lctime->tm_hour;
 
-  int tzone_offset = 0;
+  int tzone_offset = local_hour - gm_hour;
   if(gm_time > current_time && gm_hour < local_hour)
     {
     // this means gm_time is on the next day
-    tzone_offset = local_hour - gm_hour - 24;
+    tzone_offset -= 24;
     }
-  else
+  else if(gm_time < current_time && gm_hour > local_hour)
     {
-    tzone_offset = local_hour - gm_hour;
+    // this means gm_time is on the previous day
+    tzone_offset += 24;
     }
 
   tzone_offset *= 100;