comparison src/mingw-glpk-1-fixes.patch @ 4081:d5757727d1dd

glpk: Prevent crash when using glpk glp_time in mingw * src/src/mingw-glpk-1-fixes.patch: new file
author John Donoghue
date Thu, 14 Jan 2016 16:25:43 -0500
parents
children
comparison
equal deleted inserted replaced
4080:fc075c6c9a0b 4081:d5757727d1dd
1 diff -ur glpk-4.55.orig/src/env/time.c glpk-4.55/src/env/time.c
2 --- glpk-4.55.orig/src/env/time.c 2016-01-14 09:41:16.135339481 -0500
3 +++ glpk-4.55/src/env/time.c 2016-01-14 09:48:05.279096864 -0500
4 @@ -44,9 +44,24 @@
5
6 #define EPOCH 2440588 /* jday(1, 1, 1970) */
7
8 -/* POSIX version ******************************************************/
9 +#if defined(__MINGW32__)
10 +
11 +#include <windows.h>
12
13 -#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
14 +double glp_time(void)
15 +{ SYSTEMTIME st;
16 + int j;
17 + double t;
18 + GetSystemTime(&st);
19 + j = jday(st.wDay, st.wMonth, st.wYear);
20 + xassert(j >= 0);
21 + t = ((((double)(j - EPOCH) * 24.0 + (double)st.wHour) * 60.0 +
22 + (double)st.wMinute) * 60.0 + (double)st.wSecond) * 1000.0 +
23 + (double)st.wMilliseconds;
24 + return t;
25 +}
26 +/* POSIX version ******************************************************/
27 +#elif defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
28
29 #include <sys/time.h>
30 #include <time.h>