# HG changeset patch # User Balazs Dezso # Date 2008-04-14 19:27:36 # Node ID 0775d2ba2afb444ef8d440264ebbd91d4b8a60fc # Parent d76e2ff9c70d06f1abc88bc8f3c5ff09681b5c48 MinGW compatibility for graph_to_eps.h diff --git a/lemon/graph_to_eps.h b/lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h +++ b/lemon/graph_to_eps.h @@ -19,19 +19,18 @@ #ifndef LEMON_GRAPH_TO_EPS_H #define LEMON_GRAPH_TO_EPS_H -#include - -#ifdef WIN32 -#include -#endif - #include #include #include #include #include +#ifndef WIN32 +#include #include +#else +#include +#endif #include #include @@ -717,13 +716,30 @@ if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n'; // << "%%Copyright: XXXX\n" os << "%%Creator: LEMON, graphToEps()\n"; - - { - char cbuf[50]; + + { +#ifndef WIN32 timeval tv; gettimeofday(&tv, 0); + + char cbuf[26]; ctime_r(&tv.tv_sec,cbuf); os << "%%CreationDate: " << cbuf; +#else + SYSTEMTIME time; + char buf1[11], buf2[9], buf3[5]; + + GetSystemTime(&time); + 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 << "%%CreationDate: " << buf1 << ' ' + << buf2 << ' ' << buf3 << std::endl; + } +#endif } if (_autoArcWidthScale) {