title: std::get_time and other locale functionality not working correctly on Windows
body: <p>In my attempts to make libc++ and its tests work on Windows, I have come to a problem I can't seem to wrap my head around. The following code is taken from libc++ test code, and passes on Mac (aand probably FreeBSD as well), but not with MinGW-w64 nor MSVC 2010 SP1.</p>
  
  <pre><code>#include &lt;iomanip&gt;
  #include &lt;iostream&gt;
  #include &lt;cassert&gt;
  
  template &lt;class CharT&gt;
  struct testbuf
      : public std::basic_streambuf&lt;CharT&gt;
  {
      typedef std::basic_string&lt;CharT&gt; string_type;
      typedef std::basic_streambuf&lt;CharT&gt; base;
  private:
      string_type str_;
  public:
  
      testbuf() {}
      testbuf(const string_type&amp; str)
          : str_(str)
      {
          base::setg(const_cast&lt;CharT*&gt;(str_.data()),
                     const_cast&lt;CharT*&gt;(str_.data()),
                     const_cast&lt;CharT*&gt;(str_.data()) + str_.size());
      }
  };
  #if _WIN32
  #define LOCALE_en_US_UTF_8 "English_USA.1252"
  #else
  #define LOCALE_en_US_UTF_8 "en_US.UTF-8"
  #endif
  int main()
  {
      testbuf&lt;char&gt; sb("  Sat Dec 31 23:55:59 2061");
      std::istream is(&amp;sb);
      is.imbue(std::locale(LOCALE_en_US_UTF_8));
      std::tm t = {0};
      is &gt;&gt; std::get_time(&amp;t, "%c");
      std::cout &lt;&lt; t.tm_sec &lt;&lt; "\n";
      std::cout &lt;&lt; t.tm_min &lt;&lt; "\n";
      std::cout &lt;&lt; t.tm_hour &lt;&lt; "\n";
      std::cout &lt;&lt; t.tm_mday &lt;&lt; "\n";
      std::cout &lt;&lt; t.tm_mon &lt;&lt; "\n";
      std::cout &lt;&lt; t.tm_year &lt;&lt; "\n";
      std::cout &lt;&lt; t.tm_wday &lt;&lt; "\n";
      assert(t.tm_sec == 59);
      assert(t.tm_min == 55);
      assert(t.tm_hour == 23);
      assert(t.tm_mday == 31);
      assert(t.tm_mon == 11);
      assert(t.tm_year == 161);
      assert(t.tm_wday == 6);
  }
  </code></pre>
  
  <p>The test passes for Mac/FreeBSD, but the different element are all 0 for Windows. This is true for MinGW-w64+libc++ and MSVC10+Microsoft's STL.</p>
  
  <p>Is this just crappy locale support in Windows or is there a wrong implementation-dependent assumption (input format) at play here I can fix or work around?</p>