Mercurial > mxe-octave
annotate src/mingw-glpk-1-fixes.patch @ 7207:9ed6500e56d3 default tip @
maint: Merge release to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 17 May 2024 20:16:41 +0200 |
parents | d5757727d1dd |
children |
rev | line source |
---|---|
4081
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
1 diff -ur glpk-4.55.orig/src/env/time.c glpk-4.55/src/env/time.c |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
2 --- glpk-4.55.orig/src/env/time.c 2016-01-14 09:41:16.135339481 -0500 |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
3 +++ glpk-4.55/src/env/time.c 2016-01-14 09:48:05.279096864 -0500 |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
4 @@ -44,9 +44,24 @@ |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
5 |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
6 #define EPOCH 2440588 /* jday(1, 1, 1970) */ |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
7 |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
8 -/* POSIX version ******************************************************/ |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
9 +#if defined(__MINGW32__) |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
10 + |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
11 +#include <windows.h> |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
12 |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
13 -#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY) |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
14 +double glp_time(void) |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
15 +{ SYSTEMTIME st; |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
16 + int j; |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
17 + double t; |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
18 + GetSystemTime(&st); |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
19 + j = jday(st.wDay, st.wMonth, st.wYear); |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
20 + xassert(j >= 0); |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
21 + t = ((((double)(j - EPOCH) * 24.0 + (double)st.wHour) * 60.0 + |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
22 + (double)st.wMinute) * 60.0 + (double)st.wSecond) * 1000.0 + |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
23 + (double)st.wMilliseconds; |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
24 + return t; |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
25 +} |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
26 +/* POSIX version ******************************************************/ |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
27 +#elif defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY) |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
28 |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
29 #include <sys/time.h> |
d5757727d1dd
glpk: Prevent crash when using glpk glp_time in mingw
John Donoghue
parents:
diff
changeset
|
30 #include <time.h> |