From dd539abf0f68dbf2621a515b5e8bafd1c4f2214e Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 29 Nov 2021 12:58:44 +0100 Subject: gs-listener-dbus: GTimeVal deprecation --- src/gs-listener-dbus.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c index 0bbd17e..42acfd0 100644 --- a/src/gs-listener-dbus.c +++ b/src/gs-listener-dbus.c @@ -106,7 +106,7 @@ typedef struct char *connection; guint32 cookie; guint32 foreign_cookie; - GTimeVal since; + gint64 since; } GSListenerRefEntry; enum @@ -830,10 +830,12 @@ accumulate_ref_entry (gpointer key, GSListenerRefEntry *entry, DBusMessageIter *iter) { + GDateTime *dt; char *description; char *time; - time = g_time_val_to_iso8601 (&entry->since); + dt = g_date_time_new_from_unix_utc (entry->since); + time = g_date_time_format_iso8601 (dt); description = g_strdup_printf ("Application=\"%s\"; Since=\"%s\"; Reason=\"%s\";", entry->application, @@ -844,6 +846,7 @@ accumulate_ref_entry (gpointer key, g_free (description); g_free (time); + g_date_time_unref (dt); } static DBusHandlerResult @@ -906,7 +909,7 @@ listener_add_ck_ref_entry (GSListener *listener, entry->cookie = listener_generate_unique_key (listener, entry_type); entry->application = g_strdup ("ConsoleKit"); entry->reason = g_strdup ("Session is not active"); - g_get_current_time (&entry->since); + entry->since = g_get_real_time () / G_USEC_PER_SEC; /* takes ownership of entry */ listener_add_ref_entry (listener, entry_type, entry); @@ -973,7 +976,7 @@ listener_dbus_add_ref_entry (GSListener *listener, entry->cookie = listener_generate_unique_key (listener, entry_type); entry->application = g_strdup (application); entry->reason = g_strdup (reason); - g_get_current_time (&entry->since); + entry->since = g_get_real_time () / G_USEC_PER_SEC; listener_add_ref_entry (listener, entry_type, entry); -- cgit v1.2.1