Advertisement
Guest User

Windows 10 regression in time format for norwegian.

a guest
Jul 31st, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     wchar_t timeSeparator[] = { 0, 0, 0, 0 }; // Can be up to four characters
  9.     wchar_t timeFormat[256];
  10.     ZeroMemory(timeFormat, sizeof(timeFormat));
  11.  
  12.     GetLocaleInfoEx(L"nb-NO", LOCALE_STIME, timeSeparator, sizeof(timeSeparator) >> 1); // Note that LOCALE_STIME is deprecated.
  13.  
  14.     GetLocaleInfoEx(L"nb-NO", LOCALE_STIMEFORMAT, timeFormat, sizeof(timeFormat) >> 1);
  15.  
  16.     wchar_t foundSeparator = L' ';
  17.  
  18.     for (auto ch : timeFormat)
  19.     {
  20.         if (!isalpha(ch))
  21.         {
  22.             foundSeparator = ch;
  23.             break;
  24.         }
  25.     }
  26.  
  27.     wcout << "The time separator is '" << timeSeparator << "' and the time format is '" << timeFormat << "' which should use the separator '" << foundSeparator << "'." << endl;
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement