Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
In the "Test DateTime Conversion" in PropertyTests.cpp, the test
int64_t timestamp = 0LL; REQUIRE(true == org::apache::nifi::minifi::core::Property::StringToDateTime("1970-01-01T00:00:00Z", timestamp)); REQUIRE(0LL == timestamp);
fails, because StringToDateTime uses mktime internally to convert a UTC stuct tm to a localtime time_h, and then adjust it back to UTC by adding a time zone offset.
"1970-01-01T00:00:00" in local time east of Greenwich results in a negative time_h value, which is not officially supported by mktime. On Windows, mktime returns -1 to signal an error, so the test fails. On Linux, if the time zone is UTC+1, mktime returns -3600, so the test passes; however, if we were to test "1970-01-01T00:59:59", then mktime would have to return -1 as the answer, which looks like an error, so this test would fail.