Converting ISO time to std::chrono::time_point
<p>I have the following function to convert a ISO type string to a <code>std::chrono::time_point</code> format with milliseconds precision. The code always worked fine on Linux, but now I need to convert it to Windows. </p>

<p>To use the same code I compiled it with <code>_WIN32</code>flag for Windows and changed the <code>strptime</code> code that is not supported on VS2010, the compiler I´m using.</p>

<p>On windows it does not convert properly - for for evey single time string I enter the remaining result is incorrect. I cannot find out what am I doing wrong:</p>

<pre><code>        std::chrono::time_point&lt;std::chrono::system_clock&gt; convertISOStringToTimePoint(std::string isoString)
        {
            struct tm timeDate;

#ifdef _WIN32
            timeDate.tm_year = std::stoi(isoString.substr(0, 4));
            timeDate.tm_mon = std::stoi(isoString.substr(5, 2)) - 1;
            timeDate.tm_mday = std::stoi(isoString.substr(8, 2));
            timeDate.tm_hour = std::stoi(isoString.substr(11, 2));
            timeDate.tm_min = std::stoi(isoString.substr(14, 2));
            timeDate.tm_sec = std::stoi(isoString.substr(17, 2));
            timeDate.tm_isdst = -1;
#else
            strptime(isoString.c_str(), "%FT%TZ", &amp;timeDate);
#endif
            time_t t = mktime(&amp;timeDate);

            std::chrono::time_point&lt;std::chrono::system_clock&gt; time;
            time = std::chrono::system_clock::from_time_t(t);

            auto timeMs = std::chrono::time_point_cast&lt;std::chrono::milliseconds&gt;(time);

            int value = std::stoi(isoString.substr(20,3));

            timeMs += std::chrono::milliseconds(value);

            return timeMs;
        }
</code></pre>

<p>Help appreciated to find out what´s going on here....</p>