/******************************************************************************
* Icinga 2 *
- * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.org/) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
******************************************************************************/
#include "icinga/legacytimeperiod.hpp"
-#include <boost/test/unit_test.hpp>
+#include <BoostTestTargetConfig.h>
using namespace icinga;
{
char *tz;
- GlobalTimezoneFixture(void)
+ GlobalTimezoneFixture()
{
tz = getenv("TZ");
+#ifdef _WIN32
+ _putenv_s("TZ", "UTC");
+#else
setenv("TZ", "", 1);
+#endif
tzset();
}
- ~GlobalTimezoneFixture(void)
+ ~GlobalTimezoneFixture()
{
+#ifdef _WIN32
+ if (tz)
+ _putenv_s("TZ", tz);
+ else
+ _putenv_s("TZ", "");
+#else
if (tz)
setenv("TZ", tz, 1);
else
unsetenv("TZ");
+#endif
tzset();
}
};
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);