[ 
https://issues.apache.org/jira/browse/MINIFICPP-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marton Szasz updated MINIFICPP-1293:
------------------------------------
    Fix Version/s:     (was: 0.8.0)
                   0.9.0

> 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
>            Priority: Minor
>             Fix For: 0.9.0
>
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> 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: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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to