[gnumeric] solver: avoid UMRs on win32.



commit 0031d13f4c0894664038ef541177de0468f9ab1c
Author: Morten Welinder <terra gnome org>
Date:   Thu Oct 29 11:05:55 2009 -0400

    solver: avoid UMRs on win32.

 NEWS                       |    1 +
 src/tools/solver/ChangeLog |    4 ++++
 src/tools/solver/solver.c  |   11 +++++------
 3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index d2c3a66..82c8593 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,7 @@ Morten:
 	* Add lpsolve output format.
 	* Plug solver leaks.
 	* Some solver cleanups.
+	* Fix reading of solver constraints.
 
 Yaacov Zamir:
        * Hebrew Calendar functions.  [#153738]
diff --git a/src/tools/solver/ChangeLog b/src/tools/solver/ChangeLog
index d693454..d1ef312 100644
--- a/src/tools/solver/ChangeLog
+++ b/src/tools/solver/ChangeLog
@@ -1,3 +1,7 @@
+2009-10-29  Morten Welinder  <terra gnome org>
+
+	* solver.c (solver_run): Avoid UMRs on Win32.
+
 2009-10-28  Morten Welinder  <terra gnome org>
 
 	* solver.c (gnm_solver_constraint_as_str): New function.
diff --git a/src/tools/solver/solver.c b/src/tools/solver/solver.c
index ae35174..35b9cdf 100644
--- a/src/tools/solver/solver.c
+++ b/src/tools/solver/solver.c
@@ -707,7 +707,7 @@ solver_run (WorkbookControl *wbc, Sheet *sheet,
 	SolverProgram     program;
 	SolverResults     *res;
 	GTimeVal          start, end;
-#ifdef HAVE_TIMES
+#if defined(HAVE_TIMES) && defined(HAVE_SYSCONF)
 	struct tms        buf;
 
 	times (&buf);
@@ -718,10 +718,12 @@ solver_run (WorkbookControl *wbc, Sheet *sheet,
 	if (check_program_definition_failures (sheet, param, &res, errmsg))
 	        return NULL;
 
-#ifdef HAVE_SYSCONF
+#if defined(HAVE_TIMES) && defined(HAVE_SYSCONF)
 	res->time_user   = - buf.tms_utime / (gnm_float) sysconf (_SC_CLK_TCK);
 	res->time_system = - buf.tms_stime / (gnm_float) sysconf (_SC_CLK_TCK);
 #else
+	res->time_user = 0;
+	res->time_system = 0;
 #warning TODO
 #endif
 	res->time_real   = - (start.tv_sec +
@@ -736,15 +738,12 @@ solver_run (WorkbookControl *wbc, Sheet *sheet,
 
         res->status = alg->solve_fn (program);
 	g_get_current_time (&end);
-#ifdef HAVE_TIMES
+#if defined(HAVE_TIMES) && defined(HAVE_SYSCONF)
 	times (&buf);
-#ifdef HAVE_SYSCONF
 	res->time_user   += buf.tms_utime / (gnm_float) sysconf (_SC_CLK_TCK);
 	res->time_system += buf.tms_stime / (gnm_float) sysconf (_SC_CLK_TCK);
 #else
 #warning TODO
-#endif
-#else
 	res->time_user   = 0;
 	res->time_system = 0;
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]