tests: Stop using deprecated g_get_current_time()

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1438
This commit is contained in:
Philip Withnall 2019-07-24 14:10:05 +01:00
parent 161654681f
commit de25be72f0
2 changed files with 8 additions and 10 deletions

View File

@ -361,13 +361,12 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
SyncThreadData data1;
SyncThreadData data2;
SyncThreadData data3;
GTimeVal start_time;
GTimeVal end_time;
gint64 start_time, end_time;
guint elapsed_msec;
do_async = (n == 0);
g_get_current_time (&start_time);
start_time = g_get_real_time ();
data1.proxy = proxy;
data1.msec = 40;
@ -397,10 +396,9 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
g_thread_join (thread2);
g_thread_join (thread3);
g_get_current_time (&end_time);
end_time = g_get_real_time ();
elapsed_msec = ((end_time.tv_sec * G_USEC_PER_SEC + end_time.tv_usec) -
(start_time.tv_sec * G_USEC_PER_SEC + start_time.tv_usec)) / 1000;
elapsed_msec = (end_time - start_time) / 1000;
//g_debug ("Elapsed time for %s = %d msec", n == 0 ? "async" : "sync", elapsed_msec);

View File

@ -66,14 +66,14 @@ socket_client_event (GSocketClient *client,
GSocketConnection *connection)
{
static GEnumClass *event_class;
GTimeVal tv;
gint64 now_us;
if (!event_class)
event_class = g_type_class_ref (G_TYPE_SOCKET_CLIENT_EVENT);
g_get_current_time (&tv);
printf ("% 12ld.%06ld GSocketClient => %s [%s]\n",
tv.tv_sec, tv.tv_usec,
now_us = g_get_real_time ();
g_print ("%" G_GINT64_FORMAT " GSocketClient => %s [%s]\n",
now_us,
g_enum_get_value (event_class, event)->value_nick,
connection ? G_OBJECT_TYPE_NAME (connection) : "");
}