Skip to content
Snippets Groups Projects
Commit 8db52a53 authored by Emilio Pozuelo Monfort's avatar Emilio Pozuelo Monfort Committed by Zeeshan Ali Khan
Browse files

where-am-i: Show location timestamp

If available.

https://bugs.freedesktop.org/show_bug.cgi?id=94157
parent 104ab575
No related branches found
No related tags found
Loading
......@@ -74,6 +74,8 @@ print_location (GClueSimple *simple)
{
GClueLocation *location;
gdouble altitude, speed, heading;
GVariant *timestamp;
GTimeVal tv = { 0 };
const char *desc;
location = gclue_simple_get_location (simple);
......@@ -96,6 +98,24 @@ print_location (GClueSimple *simple)
desc = gclue_location_get_description (location);
if (strlen (desc) > 0)
g_print ("Description: %s\n", desc);
timestamp = gclue_location_get_timestamp (location);
if (timestamp) {
GDateTime *date_time;
gchar *str;
g_variant_get (timestamp, "(tt)", &tv.tv_sec, &tv.tv_usec);
g_variant_unref (timestamp);
date_time = g_date_time_new_from_timeval_local (&tv);
str = g_date_time_format
(date_time,
"%c (%s seconds since the Epoch)");
g_date_time_unref (date_time);
g_print ("Timestamp: %s\n", str);
g_free (str);
}
}
static void
......
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