# HG changeset patch
# User Janos Tapolcai <tapolcai@tmit.bme.hu>
# Date 1234890607 -3600
# Node ID 4b03fc4ad52161fd92c3e61b4ed8a5e9297813f0
# Parent  879c55700cd4bf2903772de56606fc0aa6e99710
Further fixes to windows.cc

diff --git a/lemon/bits/windows.cc b/lemon/bits/windows.cc
--- a/lemon/bits/windows.cc
+++ b/lemon/bits/windows.cc
@@ -27,6 +27,12 @@
 #endif
 #ifndef NOMINMAX
 #define NOMINMAX
+#endif
+#ifndef UNICODE
+#define UNICODE
+#endif
+#if !defined(_T)
+#define _T(x)      L ## x
 #endif
 #include <windows.h>
 #else
@@ -87,27 +93,19 @@
 #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) &&
+#if defined(_MSC_VER) && (_MSC_VER >= 1500)
+      char buf1[11], buf2[9], buf3[5];
+#else
+      wchar_t buf1[11], buf2[9], buf3[5];
+#endif
+	  if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        _T("ddd MMM dd"), buf1, 11) &&
           GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
-                        L"HH':'mm':'ss", buf2, 9) &&
+                        _T("HH':'mm':'ss"), buf2, 9) &&
           GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
-                        L"yyyy", buf3, 5)) {
+                        _T("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;
