[Lemon-commits] Balazs Dezso: MinGW compatibility for graph_to_e...

Lemon HG hg at lemon.cs.elte.hu
Thu Apr 17 18:22:47 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/0775d2ba2afb
changeset: 134:0775d2ba2afb
user:      Balazs Dezso <deba [at] inf.elte.hu>
date:      Mon Apr 14 19:27:36 2008 +0200
description:
	MinGW compatibility for graph_to_eps.h

diffstat:

1 file changed, 25 insertions(+), 9 deletions(-)
lemon/graph_to_eps.h |   34 +++++++++++++++++++++++++---------

diffs (62 lines):

diff -r d76e2ff9c70d -r 0775d2ba2afb lemon/graph_to_eps.h
--- a/lemon/graph_to_eps.h	Sun Apr 13 08:20:43 2008 +0100
+++ b/lemon/graph_to_eps.h	Mon Apr 14 19:27:36 2008 +0200
@@ -19,19 +19,18 @@
 #ifndef LEMON_GRAPH_TO_EPS_H
 #define LEMON_GRAPH_TO_EPS_H
 
-#include <sys/time.h>
-
-#ifdef WIN32
-#include <lemon/bits/mingw32_time.h>
-#endif
-
 #include<iostream>
 #include<fstream>
 #include<sstream>
 #include<algorithm>
 #include<vector>
 
+#ifndef WIN32
+#include<sys/time.h>
 #include<ctime>
+#else
+#include<windows.h>
+#endif
 
 #include<lemon/math.h>
 #include<lemon/bits/invalid.h>
@@ -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) {



More information about the Lemon-commits mailing list