[gnumeric] Comilation: tend to dead kittens.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Comilation: tend to dead kittens.
- Date: Thu, 9 Jul 2020 22:41:36 +0000 (UTC)
commit da5be71f6e2352bd81be54c168d4a38cc4bf2afe
Author: Morten Welinder <terra gnome org>
Date: Thu Jul 9 18:41:05 2020 -0400
Comilation: tend to dead kittens.
NEWS | 3 ++-
plugins/excel/xlsx-write-docprops.c | 5 +----
plugins/excelplugins/ExcelTestModule.c | 2 +-
src/dialogs/dialog-simulation.c | 12 ++++--------
src/expr.c | 2 +-
src/gutils.c | 6 +-----
src/tools/gnm-solver.c | 4 +---
src/tools/simulation.c | 6 +++---
src/tools/simulation.h | 2 +-
9 files changed, 15 insertions(+), 27 deletions(-)
---
diff --git a/NEWS b/NEWS
index de5716bb3..c1771b6e6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Andreas:
* Improve export of line markers to ODF for interoperability
* Improve line marker handling on import
* Fix LaTeX export. [#489]
- * When reading an ODF file make all sheets of equal size. [#505]
+ * When reading an ODF file make all sheets of equal size. [#505]
Jean:
* Fix xlsx object non-import crash.
@@ -29,6 +29,7 @@ Morten:
* Re-tune dependency bucket system. [#502]
* Fix global name parsing problem with non-uniform sheet sizing.
* Avoid style dependency redraw during file load.
+ * Tend to dead kittens.
--------------------------------------------------------------------------
Gnumeric 1.12.47
diff --git a/plugins/excel/xlsx-write-docprops.c b/plugins/excel/xlsx-write-docprops.c
index 42dca6b8d..0c0e90538 100644
--- a/plugins/excel/xlsx-write-docprops.c
+++ b/plugins/excel/xlsx-write-docprops.c
@@ -102,10 +102,7 @@ xlsx_map_to_date_core (GsfXMLOut *output, GValue const *val)
} else {
GsfTimestamp * ts = gsf_timestamp_new ();
char *str;
- GTimeVal tm;
- g_get_current_time (&tm);
- tm.tv_usec = 0L;
- gsf_timestamp_set_time (ts, tm.tv_sec);
+ gsf_timestamp_set_time (ts, g_get_real_time () / 1000000);
str = gsf_timestamp_as_string (ts);
gsf_xml_out_add_cstr (output, NULL, str);
g_free (str);
diff --git a/plugins/excelplugins/ExcelTestModule.c b/plugins/excelplugins/ExcelTestModule.c
index b58452879..2fbeb2834 100644
--- a/plugins/excelplugins/ExcelTestModule.c
+++ b/plugins/excelplugins/ExcelTestModule.c
@@ -118,7 +118,7 @@ static void copy_construct_xloper(XLOPER*x,const XLOPER*y){
if (NULL!=x){
x->xltype=xltypeMissing;
if(NULL!=y){
- g_memmove(x,y,sizeof(XLOPER));
+ memmove(x,y,sizeof(XLOPER));
switch(y->xltype & xltypeType){
case xltypeStr:
x->val.str=duplicate_pascal_string(y->val.str);
diff --git a/src/dialogs/dialog-simulation.c b/src/dialogs/dialog-simulation.c
index 6a188948b..ec2584822 100644
--- a/src/dialogs/dialog-simulation.c
+++ b/src/dialogs/dialog-simulation.c
@@ -180,10 +180,7 @@ update_log (SimulationState *state, simulation_t *sim)
break;
case 4:
g_string_append_printf (buf, "%.2" GNM_FORMAT_g,
- sim->end.tv_sec -
- sim->start.tv_sec +
- (sim->end.tv_usec -
- sim->start.tv_usec) /
+ (sim->end - sim->start) /
(gnm_float) G_USEC_PER_SEC);
break;
case 5:
@@ -336,10 +333,9 @@ simulation_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
w = go_gtk_builder_get_widget (state->gui, "max-time");
sim.max_time = gtk_spin_button_get_value (GTK_SPIN_BUTTON (w)) - 1;
- g_get_current_time (&sim.start);
- err = simulation_tool (GNM_WBC (state->wbcg),
- &dao, &sim);
- g_get_current_time (&sim.end);
+ sim.start = g_get_monotonic_time ();
+ err = simulation_tool (GNM_WBC (state->wbcg), &dao, &sim);
+ sim.end = g_get_monotonic_time ();
if (err == NULL) {
results_sim_index = sim.first_round;
diff --git a/src/expr.c b/src/expr.c
index 03e3986d2..1437e81d0 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -3120,7 +3120,7 @@ gnm_expr_top_multiple_as_string (GnmExprTop const *texpr,
// have made it into convs, but it'll do.
size_t l = strlen (res);
if (l >= 2 && res[0] == '(' && res[l - 1] == ')') {
- g_memmove (res, res + 1, l - 2);
+ memmove (res, res + 1, l - 2);
res[l - 2] = 0;
}
}
diff --git a/src/gutils.c b/src/gutils.c
index d099cf29d..cf7f54d30 100644
--- a/src/gutils.c
+++ b/src/gutils.c
@@ -699,13 +699,9 @@ void
gnm_insert_meta_date (GODoc *doc, char const *name)
{
GValue *value = g_new0 (GValue, 1);
- GTimeVal tm;
GsfTimestamp *ts = gsf_timestamp_new ();
- g_get_current_time (&tm);
- tm.tv_usec = 0L;
-
- gsf_timestamp_set_time (ts, tm.tv_sec);
+ gsf_timestamp_set_time (ts, g_get_real_time () / 1000000);
g_value_init (value, GSF_TIMESTAMP_TYPE);
gsf_timestamp_to_value (ts, value);
gsf_timestamp_free (ts);
diff --git a/src/tools/gnm-solver.c b/src/tools/gnm-solver.c
index b3bedeaa9..d19141aaa 100644
--- a/src/tools/gnm-solver.c
+++ b/src/tools/gnm-solver.c
@@ -1121,9 +1121,7 @@ gnm_solver_stop (GnmSolver *sol, GError **err)
static double
current_time (void)
{
- GTimeVal now;
- g_get_current_time (&now);
- return now.tv_sec + (now.tv_usec / 1e6);
+ return g_get_monotonic_time () / 1e6;
}
diff --git a/src/tools/simulation.c b/src/tools/simulation.c
index ace1e602c..067fba276 100644
--- a/src/tools/simulation.c
+++ b/src/tools/simulation.c
@@ -396,12 +396,12 @@ simulation_tool (WorkbookControl *wbc,
for (i = 0; i < sim->n_iterations; i++) {
err = recompute_outputs (sim, outputs, i, round);
if (i % 100 == 99) {
- g_get_current_time (&sim->end);
- if (sim->end.tv_sec - sim->start.tv_sec >
+ sim->end = g_get_monotonic_time ();
+ if ((sim->end - sim->start) / 1e6 >
sim->max_time) {
err = _("Maximum time exceeded. "
"Simulation was not "
- "completed. ");
+ "completed.");
goto out;
}
}
diff --git a/src/tools/simulation.h b/src/tools/simulation.h
index f61b79f79..921af82c2 100644
--- a/src/tools/simulation.h
+++ b/src/tools/simulation.h
@@ -45,7 +45,7 @@ typedef struct {
GSList *list_outputs;
gchar **cellnames;
- GTimeVal start, end;
+ gint64 start, end;
simstats_t **stats;
} simulation_t;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]