# HG changeset patch # User Janos Tapolcai # Date 2009-02-17 18:10:07 # Node ID 3f0ddf25552425840f54c4bb31bc431a92b3c377 # Parent 879c55700cd4bf2903772de56606fc0aa6e99710 Further fixes to windows.cc (#215) diff --git a/lemon/bits/windows.cc b/lemon/bits/windows.cc --- a/lemon/bits/windows.cc +++ b/lemon/bits/windows.cc @@ -28,7 +28,15 @@ #ifndef NOMINMAX #define NOMINMAX #endif +#ifdef UNICODE +#undef UNICODE +#endif #include +#ifdef LOCALE_INVARIANT +#define MY_LOCALE LOCALE_INVARIANT +#else +#define MY_LOCALE LOCALE_NEUTRAL +#endif #else #include #include @@ -87,27 +95,15 @@ #ifdef WIN32 SYSTEMTIME time; GetSystemTime(&time); -#if defined(_MSC_VER) && (_MSC_VER < 1500) - LPWSTR buf1, buf2, buf3; - if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, - L"ddd MMM dd", buf1, 11) && - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, - L"HH':'mm':'ss", buf2, 9) && - GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, - L"yyyy", buf3, 5)) { + char buf1[11], buf2[9], buf3[5]; + if (GetDateFormat(MY_LOCALE, 0, &time, + ("ddd MMM dd"), buf1, 11) && + GetTimeFormat(MY_LOCALE, 0, &time, + ("HH':'mm':'ss"), buf2, 9) && + GetDateFormat(MY_LOCALE, 0, &time, + ("yyyy"), buf3, 5)) { os << buf1 << ' ' << buf2 << ' ' << buf3; } -#else - char buf1[11], buf2[9], buf3[5]; - if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, - "ddd MMM dd", buf1, 11) && - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, - "HH':'mm':'ss", buf2, 9) && - GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, - "yyyy", buf3, 5)) { - os << buf1 << ' ' << buf2 << ' ' << buf3; - } -#endif else os << "unknown"; #else timeval tv;