You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Ferenc Gerlits (Jira)" <ji...@apache.org> on 2020/07/14 13:52:00 UTC
[jira] [Created] (MINIFICPP-1293) PropertyTests fails on Windows in
time zones east of Greenwich
Ferenc Gerlits created MINIFICPP-1293:
-----------------------------------------
Summary: PropertyTests fails on Windows in time zones east of Greenwich
Key: MINIFICPP-1293
URL: https://issues.apache.org/jira/browse/MINIFICPP-1293
Project: Apache NiFi MiNiFi C++
Issue Type: Bug
Reporter: Ferenc Gerlits
Assignee: Ferenc Gerlits
Fix For: 0.8.0
In the "Test DateTime Conversion" in PropertyTests.cpp, the test
{noformat}
int64_t timestamp = 0LL;
REQUIRE(true == org::apache::nifi::minifi::core::Property::StringToDateTime("1970-01-01T00:00:00Z", timestamp));
REQUIRE(0LL == timestamp);
{noformat}
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:00Z" 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:59Z", then {{mktime}} would have to return -1 as the answer, which looks like an error, so this test would fail.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)