diff options
author | Zach Mullen <zach.mullen@kitware.com> | 2010-03-18 17:51:40 (GMT) |
---|---|---|
committer | Zach Mullen <zach.mullen@kitware.com> | 2010-03-18 17:53:40 (GMT) |
commit | 9676c52c3ea26dcd74bdffd14fa91869c00354f7 (patch) | |
tree | 51ac6af8ac10ba265604f5776d5a614b04b15454 /Source/cmCTest.cxx | |
parent | a2fe175647718a562e41c84717b67917adbe584d (diff) | |
download | CMake-9676c52c3ea26dcd74bdffd14fa91869c00354f7.zip CMake-9676c52c3ea26dcd74bdffd14fa91869c00354f7.tar.gz CMake-9676c52c3ea26dcd74bdffd14fa91869c00354f7.tar.bz2 |
Fix for StopTime for cases when gmtime is a day ahead of localtime
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c6a3849..098bd7a 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2557,10 +2557,22 @@ void cmCTest::DetermineNextDayStop() time_t current_time = time(0); lctime = gmtime(¤t_time); int gm_hour = lctime->tm_hour; + time_t gm_time = mktime(lctime); lctime = localtime(¤t_time); int local_hour = lctime->tm_hour; - int timezone = (local_hour - gm_hour) * 100; + int tzone_offset = 0; + 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; + } + else + { + tzone_offset = local_hour - gm_hour; + } + + tzone_offset *= 100; char buf[1024]; sprintf(buf, "%d%02d%02d %s %+05i", lctime->tm_year + 1900, |