COIN-OR::LEMON - Graph Library

Ticket #74: mingw_compatibility_graph_to_eps.patch

File mingw_compatibility_graph_to_eps.patch, 1.7 KB (added by Balazs Dezso, 17 years ago)
  • lemon/graph_to_eps.h

    # HG changeset patch
    # User Balazs Dezso <deba@inf.elte.hu>
    # Date 1208194056 -7200
    # Node ID 028218c1fd0665c1ced36ba49bb375a1fc6aac3e
    # Parent  145b7e96e2108de7176e75ada42704a688545b9d
    MinGW compatibility for graph_to_eps.h
    
    diff -r 145b7e96e210 -r 028218c1fd06 lemon/graph_to_eps.h
    a b  
    1919#ifndef LEMON_GRAPH_TO_EPS_H
    2020#define LEMON_GRAPH_TO_EPS_H
    2121
    22 #include <sys/time.h>
    23 
    24 #ifdef WIN32
    25 #include <lemon/bits/mingw32_time.h>
    26 #endif
    27 
    2822#include<iostream>
    2923#include<fstream>
    3024#include<sstream>
    3125#include<algorithm>
    3226#include<vector>
    3327
     28#ifndef WIN32
     29#include<sys/time.h>
    3430#include<ctime>
     31#else
     32#include<windows.h>
     33#endif
    3534
    3635#include<lemon/math.h>
    3736#include<lemon/bits/invalid.h>
    public: 
    707706     if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
    708707//        << "%%Copyright: XXXX\n"
    709708    os << "%%Creator: LEMON, graphToEps()\n";
    710    
    711     {
    712       char cbuf[50];
     709
     710    {   
     711#ifndef WIN32
    713712      timeval tv;
    714713      gettimeofday(&tv, 0);
     714
     715      char cbuf[26];
    715716      ctime_r(&tv.tv_sec,cbuf);
    716717      os << "%%CreationDate: " << cbuf;
     718#else
     719      SYSTEMTIME time;
     720      char buf1[11], buf2[9], buf3[5];
     721     
     722      GetSystemTime(&time);
     723      if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
     724                        "ddd MMM dd", buf1, 11) &&
     725          GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
     726                        "HH':'mm':'ss", buf2, 9) &&
     727          GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
     728                                "yyyy", buf3, 5)) {
     729        os << "%%CreationDate: " << buf1 << ' '
     730           << buf2 << ' ' << buf3 << std::endl;
     731      }   
     732#endif
    717733    }
    718734
    719735    if (_autoArcWidthScale) {