Uploaded image for project: 'Apache NiFi MiNiFi C++'
  1. Apache NiFi MiNiFi C++
  2. MINIFICPP-1293

PropertyTests fails on Windows in time zones east of Greenwich

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.9.0
    • 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.

       

      Attachments

        Activity

          People

            fgerlits Ferenc Gerlits
            fgerlits Ferenc Gerlits
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 20m
                2h 20m