diff options
author | Teemu Ikonen <tpikonen@mailbox.org> | 2021-10-20 20:38:39 +0300 |
---|---|---|
committer | Teemu Ikonen <tpikonen@mailbox.org> | 2021-10-21 14:59:12 +0300 |
commit | 3e713dd38107fc430e41a94ec7964dccd905768e (patch) | |
tree | 3f8b19e54ae21a471ae6dcaf8e8f83fcffa1b363 | |
parent | fe7d32a49c1f7bf2b9fe47870850f18b02799841 (diff) | |
download | geoclue-3e713dd38107fc430e41a94ec7964dccd905768e.tar.gz |
mozilla: Don't use GTimeVal and g_time_val_to_iso8601
They have been deprecated since GLib version 2.62.
-rw-r--r-- | src/gclue-mozilla.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gclue-mozilla.c b/src/gclue-mozilla.c index 6d25a31..69927a2 100644 --- a/src/gclue-mozilla.c +++ b/src/gclue-mozilla.c @@ -298,12 +298,12 @@ gclue_mozilla_create_submit_query (GClueLocation *location, JsonBuilder *builder; JsonGenerator *generator; JsonNode *root_node; - char *data, *timestamp; + char *data, *timestr; const char *url, *nick; gsize data_len; GList *iter; gdouble lat, lon, accuracy, altitude; - GTimeVal tv; + GDateTime *datetime; url = get_submit_config (&nick); if (url == NULL) @@ -337,12 +337,16 @@ gclue_mozilla_create_submit_query (GClueLocation *location, json_builder_add_double_value (builder, altitude); } - tv.tv_sec = gclue_location_get_timestamp (location); - tv.tv_usec = 0; - timestamp = g_time_val_to_iso8601 (&tv); + datetime = g_date_time_new_from_unix_local + (gclue_location_get_timestamp (location)); + /* We need to be compatible with GLib 2.56 so we cannot use this: + * timestr = g_date_time_format_iso8601 (datetime); + * Construct the format manually instead: */ + timestr = g_date_time_format (datetime, "%Y-%m-%dT%H:%M:%S%:::z"); json_builder_set_member_name (builder, "time"); - json_builder_add_string_value (builder, timestamp); - g_free (timestamp); + json_builder_add_string_value (builder, timestr); + g_free (timestr); + g_object_unref (datetime); json_builder_set_member_name (builder, "radioType"); json_builder_add_string_value (builder, "gsm"); |