Merge VS and AIX related fixes 1.0
authorAlpar Juttner <alpar@cs.elte.hu>
Tue, 10 Feb 2009 17:29:39 +0000
branch1.0
changeset 3675a894f2d9325
parent 363 7e0d5d971bab
parent 366 daddd623ac9a
child 369 65f80c81d41c
Merge VS and AIX related fixes
     1.1 --- a/lemon/graph_to_eps.h	Fri Jan 23 18:13:24 2009 +0000
     1.2 +++ b/lemon/graph_to_eps.h	Tue Feb 10 17:29:39 2009 +0000
     1.3 @@ -29,8 +29,12 @@
     1.4  #include<sys/time.h>
     1.5  #include<ctime>
     1.6  #else
     1.7 +#ifndef WIN32_LEAN_AND_MEAN
     1.8  #define WIN32_LEAN_AND_MEAN
     1.9 +#endif
    1.10 +#ifndef NOMINMAX
    1.11  #define NOMINMAX
    1.12 +#endif
    1.13  #include<windows.h>
    1.14  #endif
    1.15  
    1.16 @@ -688,18 +692,30 @@
    1.17        os << "%%CreationDate: " << cbuf;
    1.18  #else
    1.19        SYSTEMTIME time;
    1.20 -      char buf1[11], buf2[9], buf3[5];
    1.21 -
    1.22        GetSystemTime(&time);
    1.23 +#if defined(_MSC_VER) && (_MSC_VER < 1500)
    1.24 +      LPWSTR buf1, buf2, buf3;
    1.25        if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    1.26 -                        "ddd MMM dd", buf1, 11) &&
    1.27 +                        L"ddd MMM dd", buf1, 11) &&
    1.28            GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    1.29 -                        "HH':'mm':'ss", buf2, 9) &&
    1.30 +                        L"HH':'mm':'ss", buf2, 9) &&
    1.31            GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    1.32 -                                "yyyy", buf3, 5)) {
    1.33 +                        L"yyyy", buf3, 5)) {
    1.34          os << "%%CreationDate: " << buf1 << ' '
    1.35             << buf2 << ' ' << buf3 << std::endl;
    1.36        }
    1.37 +#else
    1.38 +        char buf1[11], buf2[9], buf3[5];
    1.39 +        if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    1.40 +                          "ddd MMM dd", buf1, 11) &&
    1.41 +            GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    1.42 +                          "HH':'mm':'ss", buf2, 9) &&
    1.43 +            GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    1.44 +                          "yyyy", buf3, 5)) {
    1.45 +          os << "%%CreationDate: " << buf1 << ' '
    1.46 +             << buf2 << ' ' << buf3 << std::endl;
    1.47 +        }
    1.48 +#endif
    1.49  #endif
    1.50      }
    1.51  
     2.1 --- a/lemon/time_measure.h	Fri Jan 23 18:13:24 2009 +0000
     2.2 +++ b/lemon/time_measure.h	Tue Feb 10 17:29:39 2009 +0000
     2.3 @@ -24,11 +24,16 @@
     2.4  ///\brief Tools for measuring cpu usage
     2.5  
     2.6  #ifdef WIN32
     2.7 +#ifndef WIN32_LEAN_AND_MEAN
     2.8  #define WIN32_LEAN_AND_MEAN
     2.9 +#endif
    2.10 +#ifndef NOMINMAX
    2.11  #define NOMINMAX
    2.12 +#endif
    2.13  #include <windows.h>
    2.14  #include <cmath>
    2.15  #else
    2.16 +#include <unistd.h>
    2.17  #include <sys/times.h>
    2.18  #include <sys/time.h>
    2.19  #endif