COIN-OR::LEMON - Graph Library

Ticket #215: 28b3dec413f1_tj3.patch

File 28b3dec413f1_tj3.patch, 1.9 KB (added by Tapolcai János, 16 years ago)

this file seems to compile under windows and linux

  • lemon/bits/windows.cc

    # HG changeset patch
    # User "Janos Tapolcai <tapolcai@tmit.bme.hu>"
    # Date 1234859983 -3600
    # Node ID 28b3dec413f1afefe092ed44c22382351929d4d2
    # Parent  879c55700cd4bf2903772de56606fc0aa6e99710
    trying some durty hacking for windows
    
    diff --git a/lemon/bits/windows.cc b/lemon/bits/windows.cc
    a b  
    2828#ifndef NOMINMAX
    2929#define NOMINMAX
    3030#endif
     31#define UNICODE
     32#define _T(x)      L ## x
     33
    3134#include <windows.h>
    3235#else
    3336#include <unistd.h>
    3437#include <ctime>
    3538#include <sys/times.h>
    3639#include <sys/time.h>
     40#define _T(x)      x
    3741#endif
    3842
    3943#include <cmath>
     
    8892      SYSTEMTIME time;
    8993      GetSystemTime(&time);
    9094#if defined(_MSC_VER) && (_MSC_VER < 1500)
    91       LPWSTR buf1, buf2, buf3;
    92       if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    93                         L"ddd MMM dd", buf1, 11) &&
     95      wchar_t buf1[11], buf2[9], buf3[5];
     96#else     
     97      char buf1[11], buf2[9], buf3[5];
     98#endif
     99          if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
     100                        _T("ddd MMM dd"), buf1, 11) &&
    94101          GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    95                         L"HH':'mm':'ss", buf2, 9) &&
     102                        _T("HH':'mm':'ss"), buf2, 9) &&
    96103          GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    97                         L"yyyy", buf3, 5)) {
     104                        _T("yyyy"), buf3, 5)) {
    98105        os << buf1 << ' ' << buf2 << ' ' << buf3;
    99106      }
    100 #else
    101       char buf1[11], buf2[9], buf3[5];
    102       if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    103                         "ddd MMM dd", buf1, 11) &&
    104           GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    105                         "HH':'mm':'ss", buf2, 9) &&
    106           GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    107                         "yyyy", buf3, 5)) {
    108         os << buf1 << ' ' << buf2 << ' ' << buf3;
    109       }
    110 #endif
    111107      else os << "unknown";
    112108#else
    113109      timeval tv;