MinGW compatibility for graph_to_eps.h
authorBalazs Dezso <deba@inf.elte.hu>
Mon, 14 Apr 2008 19:27:36 +0200
changeset 1340775d2ba2afb
parent 133 d76e2ff9c70d
child 135 6e7aee618f03
MinGW compatibility for graph_to_eps.h
lemon/graph_to_eps.h
     1.1 --- a/lemon/graph_to_eps.h	Sun Apr 13 08:20:43 2008 +0100
     1.2 +++ b/lemon/graph_to_eps.h	Mon Apr 14 19:27:36 2008 +0200
     1.3 @@ -19,19 +19,18 @@
     1.4  #ifndef LEMON_GRAPH_TO_EPS_H
     1.5  #define LEMON_GRAPH_TO_EPS_H
     1.6  
     1.7 -#include <sys/time.h>
     1.8 -
     1.9 -#ifdef WIN32
    1.10 -#include <lemon/bits/mingw32_time.h>
    1.11 -#endif
    1.12 -
    1.13  #include<iostream>
    1.14  #include<fstream>
    1.15  #include<sstream>
    1.16  #include<algorithm>
    1.17  #include<vector>
    1.18  
    1.19 +#ifndef WIN32
    1.20 +#include<sys/time.h>
    1.21  #include<ctime>
    1.22 +#else
    1.23 +#include<windows.h>
    1.24 +#endif
    1.25  
    1.26  #include<lemon/math.h>
    1.27  #include<lemon/bits/invalid.h>
    1.28 @@ -717,13 +716,30 @@
    1.29       if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
    1.30  //        << "%%Copyright: XXXX\n"
    1.31      os << "%%Creator: LEMON, graphToEps()\n";
    1.32 -    
    1.33 -    {
    1.34 -      char cbuf[50];
    1.35 +
    1.36 +    {    
    1.37 +#ifndef WIN32 
    1.38        timeval tv;
    1.39        gettimeofday(&tv, 0);
    1.40 +
    1.41 +      char cbuf[26];
    1.42        ctime_r(&tv.tv_sec,cbuf);
    1.43        os << "%%CreationDate: " << cbuf;
    1.44 +#else
    1.45 +      SYSTEMTIME time;
    1.46 +      char buf1[11], buf2[9], buf3[5];
    1.47 +      
    1.48 +      GetSystemTime(&time);
    1.49 +      if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 
    1.50 +			"ddd MMM dd", buf1, 11) &&
    1.51 +	  GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, 
    1.52 +			"HH':'mm':'ss", buf2, 9) &&
    1.53 +	  GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 
    1.54 +				"yyyy", buf3, 5)) {
    1.55 +	os << "%%CreationDate: " << buf1 << ' ' 
    1.56 +	   << buf2 << ' ' << buf3 << std::endl;
    1.57 +      }	  
    1.58 +#endif
    1.59      }
    1.60  
    1.61      if (_autoArcWidthScale) {