mirror of https://github.com/Icinga/icinga2.git
Fix build errors
This commit is contained in:
parent
37d100ddef
commit
629c502ca9
|
@ -18,7 +18,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "icinga/legacytimeperiod.hpp"
|
#include "icinga/legacytimeperiod.hpp"
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <BoostTestTargetConfig.h>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -31,16 +31,27 @@ struct GlobalTimezoneFixture
|
||||||
GlobalTimezoneFixture(void)
|
GlobalTimezoneFixture(void)
|
||||||
{
|
{
|
||||||
tz = getenv("TZ");
|
tz = getenv("TZ");
|
||||||
|
#ifdef _WIN32
|
||||||
|
_putenv_s("TZ", "UTC");
|
||||||
|
#else
|
||||||
setenv("TZ", "", 1);
|
setenv("TZ", "", 1);
|
||||||
|
#endif
|
||||||
tzset();
|
tzset();
|
||||||
}
|
}
|
||||||
|
|
||||||
~GlobalTimezoneFixture(void)
|
~GlobalTimezoneFixture(void)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (tz)
|
||||||
|
_putenv_s("TZ", tz);
|
||||||
|
else
|
||||||
|
_putenv_s("TZ", "");
|
||||||
|
#else
|
||||||
if (tz)
|
if (tz)
|
||||||
setenv("TZ", tz, 1);
|
setenv("TZ", tz, 1);
|
||||||
else
|
else
|
||||||
unsetenv("TZ");
|
unsetenv("TZ");
|
||||||
|
#endif
|
||||||
tzset();
|
tzset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -50,7 +61,6 @@ BOOST_GLOBAL_FIXTURE(GlobalTimezoneFixture);
|
||||||
BOOST_AUTO_TEST_CASE(simple)
|
BOOST_AUTO_TEST_CASE(simple)
|
||||||
{
|
{
|
||||||
tm beg, end, ref;
|
tm beg, end, ref;
|
||||||
timegm(&ref);
|
|
||||||
|
|
||||||
// check parsing of "YYYY-MM-DD" specs
|
// check parsing of "YYYY-MM-DD" specs
|
||||||
LegacyTimePeriod::ParseTimeSpec("2016-01-01", &beg, &end, &ref);
|
LegacyTimePeriod::ParseTimeSpec("2016-01-01", &beg, &end, &ref);
|
||||||
|
|
Loading…
Reference in New Issue