icinga2/test
Julian Brost 5404143dee Ensure consistent mktime() DST behavior across different implementations
There are inputs to mktime() where the behavior is not specified and there's
also no single obviously correct behavior. In particular, this affects how
auto-detection of whether DST is in effect is done when tm_isdst = -1 is set
and the time specified does not exist at all or exists twice on that day.

If different implementations are used within an Icinga 2 cluster, that can lead
to inconsistent behavior because different nodes may interpret the same
TimePeriod differently.

This commit introduces a wrapper to mktime(), namely Utility::NormalizeTm()
that implements the behavior provided by glibc. The choice for glibc's behavior
is pretty arbitrary, it was simply picked because most systems that are
officially/fully supported use it (with the only exception being Windows), so
this should give the least possible amount of user-visible changes.

As part of this commit, the closely related helper function mktime_const() is
also moved to Utility::TmToTimestamp() and made a wrapper around the newly
introduced NormalizeTm().
2025-04-28 13:38:55 +02:00
..
config Remove unnecessary imports from unit test config 2016-08-28 10:41:46 +02:00
livestatus Livestatus: Fix "class" filter for log table 2015-11-26 19:15:54 +01:00
base-array.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-base64.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-convert.cpp Convert::ToString(double): handle integral values too large for long long correctly 2021-04-27 17:31:50 +02:00
base-dictionary.cpp Dictionary: Make sure underlaying map is ordered 2021-11-12 13:34:57 +01:00
base-fifo.cpp Stream#Read(): remove de facto unused param allow_partial 2023-07-13 16:55:48 +02:00
base-io-engine.cpp Don't use removed boost::asio::spawn() overload if Boost >= v1.87 2025-04-14 17:30:19 +02:00
base-json.cpp JsonEncode(): encode non-[]/{} objects as strings, not null 2021-04-30 15:49:52 +02:00
base-match.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-netstring.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-object-packer.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-object.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-serialize.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-shellescape.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-stacktrace.cpp Stacktrace test: try to prevent inlining even harder 2021-03-01 16:08:06 +01:00
base-stream.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-string.cpp Avoid undefined behavior in string/vector_move test 2025-03-10 09:28:33 +01:00
base-timer.cpp Use Timer::Create() instead of new Timer() 2023-04-04 10:35:20 +02:00
base-tlsutility.cpp Test IsCertUptodate() and IsCaUptodate() 2023-12-18 15:28:11 +01:00
base-type.cpp Add basic test cases for Type::GetConfigTypesSortedByLoadDependencies() 2024-09-20 16:18:12 +02:00
base-utility.cpp Ensure consistent mktime() DST behavior across different implementations 2025-04-28 13:38:55 +02:00
base-value.cpp Make base_value/format test easier to understand 2021-05-31 17:28:35 +02:00
CMakeLists.txt Ensure consistent mktime() DST behavior across different implementations 2025-04-28 13:38:55 +02:00
config-apply.cpp Tests: config_apply/gettargetservices_*: use BOOST_CHECK_EQUAL_COLLECTIONS() 2023-12-18 16:01:31 +01:00
config-ops.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-checkable-fixture.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-checkable-flapping.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-checkresult.cpp Checkable: Add test for state notifications after a suppression ends 2022-03-03 14:25:23 +01:00
icinga-dependencies.cpp Add basic unittests for bulk group registration 2025-03-19 16:28:00 +01:00
icinga-legacytimeperiod.cpp tests: Move GlobalTimezoneFixture to utils file 2025-04-28 13:38:38 +02:00
icinga-macros.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-notification.cpp Notification#BeginExecuteNotification(): on recovery clear last_notified_state_per_user 2023-12-13 13:21:22 +01:00
icinga-perfdata.cpp Reject infinite performance data values 2025-01-09 11:46:34 +01:00
icingaapplication-fixture.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icingaapplication-fixture.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
livestatus-fixture.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
livestatus.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
methods-pluginnotificationtask.cpp PluginNotificationTask::ScriptFunc(): on Linux truncate output and comment 2023-12-19 12:21:03 +01:00
remote-configpackageutility.cpp De-couple package and stage name validation 2021-08-02 15:40:14 +02:00
remote-url.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
test-runner.cpp Tests: _Exit() in main() 2019-07-23 12:14:06 +02:00
utils.cpp tests: Move GlobalTimezoneFixture to utils file 2025-04-28 13:38:38 +02:00
utils.hpp tests: Move GlobalTimezoneFixture to utils file 2025-04-28 13:38:38 +02:00