[Help-glpk] Thred safety

2017-01-28 Thread Heinrich Schuchardt
Here is a list of functions that are not thread safe under POSIX 2008: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01 Problematic coding includes: strtok used in mplsql.c gmtime used in time.c strerror used in stream.c, gzguts.h, mpl6.c, glprpr.c I wonder if

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread David Monniaux
On 01/28/2017 05:24 PM, Heinrich Schuchardt wrote: > gmtime_r does not exist in the C standard and not on Windows. > > Please use gmtime_s. gmtime_s does not seem to exist on Linux. I guess this is yet another occasion for a configure check. Are there any systems where the Epoch is not 1-1-1970?

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread Chris Matrakidis
Hi Andrew, > Not sure, but gmtime_s looks like a MSVC function. Could you point me > out where gmtime_s is standardized? Thanks. gmtime_s is included in the (optional) annex K of C11. However, the parameters are reversed compared to the MSVC version and the standard one returns struct tm * while

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread Andrew Makhorin
Hi Heinrich, > > > > Thank you for the patch. For reasons mentioned above I'd like to keep > > the current version; however, I will replace gmtime with gmtime_r. > > Hello Andrew > > gmtime_r does not exist in the C standard and not on Windows. > > Please use gmtime_s. > Not sure, but gmtime

[Help-glpk] GLPK for Windows 4.61

2017-01-28 Thread Heinrich Schuchardt
GLPK for Windows 4.61 has been released. It is available at http://winglpk.sourceforge.net. It comes with 32bit (cdecl and stdcall) and 64bit binaries and libraries. Examples for usage with VBA (Visual Basic for Applications) and LibreOffice have been added. The distribution includes Glpk for C#/

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread Heinrich Schuchardt
> > Thank you for the patch. For reasons mentioned above I'd like to keep > the current version; however, I will replace gmtime with gmtime_r. Hello Andrew gmtime_r does not exist in the C standard and not on Windows. Please use gmtime_s. Best regards Heinrich Schuchardt

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread David Monniaux
On 01/28/2017 02:35 PM, Heinrich Schuchardt wrote: > > 1E3 * 1E-3 = 1. > You wouldn't add seconds and microseconds without scaling. Typo (silly copying and pasting). It should have read: return tv.tv_sec * 1E3 + tv.tv_usec * 1E-3; -- David Monniaux directeur de recherche au CNRS, laboratoire VE

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread Andrew Makhorin
> Over glpk-4.61 > > src/env/time.c contains: > > double glp_time(void) > { struct timeval tv; > struct tm *tm; > int j; > double t; > gettimeofday(&tv, NULL); > tm = gmtime(&tv.tv_sec); > j = jday(tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year); > x

Re: [Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread Heinrich Schuchardt
On 01/28/2017 01:31 PM, David Monniaux wrote: > Over glpk-4.61 > > src/env/time.c contains: > > double glp_time(void) > { struct timeval tv; > struct tm *tm; > int j; > double t; > gettimeofday(&tv, NULL); > tm = gmtime(&tv.tv_sec); > j = jday(tm->tm_mday,

[Help-glpk] things I don't understand in src/env/time.c + bugs + suggested patch

2017-01-28 Thread David Monniaux
Over glpk-4.61 src/env/time.c contains: double glp_time(void) { struct timeval tv; struct tm *tm; int j; double t; gettimeofday(&tv, NULL); tm = gmtime(&tv.tv_sec); j = jday(tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year); xassert(j >= 0); t =