[Lemon-commits] Alpar Juttner: Merge VS and AIX related fixes
Lemon HG
hg at lemon.cs.elte.hu
Wed Feb 11 08:04:39 CET 2009
details: http://lemon.cs.elte.hu/hg/lemon/rev/5a894f2d9325
changeset: 513:5a894f2d9325
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Tue Feb 10 17:29:39 2009 +0000
description:
Merge VS and AIX related fixes
diffstat:
2 files changed, 26 insertions(+), 5 deletions(-)
lemon/graph_to_eps.h | 26 +++++++++++++++++++++-----
lemon/time_measure.h | 5 +++++
diffs (72 lines):
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
@@ -29,8 +29,12 @@
#include<sys/time.h>
#include<ctime>
#else
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
#include<windows.h>
#endif
@@ -688,18 +692,30 @@
os << "%%CreationDate: " << cbuf;
#else
SYSTEMTIME time;
- char buf1[11], buf2[9], buf3[5];
-
GetSystemTime(&time);
+#if defined(_MSC_VER) && (_MSC_VER < 1500)
+ LPWSTR buf1, buf2, buf3;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
- "ddd MMM dd", buf1, 11) &&
+ L"ddd MMM dd", buf1, 11) &&
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
- "HH':'mm':'ss", buf2, 9) &&
+ L"HH':'mm':'ss", buf2, 9) &&
GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
- "yyyy", buf3, 5)) {
+ L"yyyy", buf3, 5)) {
os << "%%CreationDate: " << buf1 << ' '
<< buf2 << ' ' << buf3 << std::endl;
}
+#else
+ char buf1[11], buf2[9], buf3[5];
+ 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
#endif
}
diff --git a/lemon/time_measure.h b/lemon/time_measure.h
--- a/lemon/time_measure.h
+++ b/lemon/time_measure.h
@@ -24,11 +24,16 @@
///\brief Tools for measuring cpu usage
#ifdef WIN32
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
#include <windows.h>
#include <cmath>
#else
+#include <unistd.h>
#include <sys/times.h>
#include <sys/time.h>
#endif
More information about the Lemon-commits
mailing list