]> granicus.if.org Git - icinga2/commitdiff
Fix build errors 5871/head
authorJean Flach <jean-marcel.flach@icinga.com>
Fri, 15 Dec 2017 16:58:47 +0000 (17:58 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 20 Dec 2017 07:08:02 +0000 (08:08 +0100)
test/icinga-legacytimeperiod.cpp

index df93fd817421e69da2b001607db2c30f1988cd36..cf5212b88a74ae444562f6626a964a5b487308e3 100644 (file)
@@ -18,7 +18,7 @@
  ******************************************************************************/
 
 #include "icinga/legacytimeperiod.hpp"
-#include <boost/test/unit_test.hpp>
+#include <BoostTestTargetConfig.h>
 
 using namespace icinga;
 
@@ -31,16 +31,27 @@ struct GlobalTimezoneFixture
        GlobalTimezoneFixture(void)
        {
                tz = getenv("TZ");
+#ifdef _WIN32
+               _putenv_s("TZ", "UTC");
+#else
                setenv("TZ", "", 1);
+#endif
                tzset();
        }
 
        ~GlobalTimezoneFixture(void)
        {
+#ifdef _WIN32
+               if (tz)
+                       _putenv_s("TZ", tz);
+               else
+                       _putenv_s("TZ", "");
+#else
                if (tz)
                        setenv("TZ", tz, 1);
                else
                        unsetenv("TZ");
+#endif
                tzset();
        }
 };
@@ -50,7 +61,6 @@ BOOST_GLOBAL_FIXTURE(GlobalTimezoneFixture);
 BOOST_AUTO_TEST_CASE(simple)
 {
        tm beg, end, ref;
-       timegm(&ref);
 
        // check parsing of "YYYY-MM-DD" specs
        LegacyTimePeriod::ParseTimeSpec("2016-01-01", &beg, &end, &ref);