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

This commit is contained in:
Zach Mullen 2010-03-18 14:48:42 -04:00
parent 9676c52c3e
commit 9eea95c90f
2 changed files with 10 additions and 8 deletions

View File

@ -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;

View File

@ -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;