Skip to content
Snippets Groups Projects
Commit e12703da authored by Frederic Danis's avatar Frederic Danis
Browse files

Import where-am-i demo app fix


Call to where-am-i on 32bits platform ends up with following error:
*** stack smashing detected ***: terminated

GTimeVal parameters are glong, which depends on the platform, but
timestamp returned by geoclue is guint64 for both seconds and useconds.
Furthermore GTimeVal is marked as deprecated.

Signed-off-by: default avatarFrédéric Danis <frederic.danis@collabora.com>
parent 788f2201
No related branches found
No related tags found
2 merge requests!17Merge changes from apertis/v2021-updates into apertis/v2021,!16Backport from v2023dev1
From 9ffb0cae3d3d32b60ec226818bb24582a3c0f5e4 Mon Sep 17 00:00:00 2001
From: Teemu Ikonen <tpikonen@mailbox.org>
Date: Wed, 20 Oct 2021 17:54:08 +0300
Subject: demo: Don't use GTimeVal and g_date_time_new_from_timeval_local
They have been deprecated since GLib version 2.62.
diff --git a/demo/where-am-i.c b/demo/where-am-i.c
index 4c1c2c3..eaf0f65 100644
--- a/demo/where-am-i.c
+++ b/demo/where-am-i.c
@@ -84,7 +84,6 @@ print_location (GClueSimple *simple)
GClueLocation *location;
gdouble altitude, speed, heading;
GVariant *timestamp;
- GTimeVal tv = { 0 };
const char *desc;
location = gclue_simple_get_location (simple);
@@ -111,11 +110,13 @@ print_location (GClueSimple *simple)
timestamp = gclue_location_get_timestamp (location);
if (timestamp) {
GDateTime *date_time;
+ guint64 sec, usec;
gchar *str;
- g_variant_get (timestamp, "(tt)", &tv.tv_sec, &tv.tv_usec);
+ g_variant_get (timestamp, "(tt)", &sec, &usec);
- date_time = g_date_time_new_from_timeval_local (&tv);
+ /* Ignore usec, since it is not in the output format */
+ date_time = g_date_time_new_from_unix_local ((gint64) sec);
str = g_date_time_format
(date_time,
"%c (%s seconds since the Epoch)");
......@@ -3,3 +3,4 @@
0002-config-Make-the-Mozilla-API-key-configurable.patch
0003-service-Sync-in_use-property-when-apps-get-connected.patch
0005-config-Clear-error-after-submission-URL-lookup-fails.patch
0007-demo-Don-t-use-GTimeVal-and-g_date_time_new_from_tim.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment