[glib: 18/26] tests: Stop using deprecated g_get_current_time()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 18/26] tests: Stop using deprecated g_get_current_time()
- Date: Mon, 29 Jul 2019 13:01:49 +0000 (UTC)
commit de25be72f0151d9e8537885e0e1306de268b34e7
Author: Philip Withnall <withnall endlessm com>
Date: Wed Jul 24 14:10:05 2019 +0100
tests: Stop using deprecated g_get_current_time()
Signed-off-by: Philip Withnall <withnall endlessm com>
Helps: #1438
gio/tests/gdbus-threading.c | 10 ++++------
gio/tests/send-data.c | 8 ++++----
2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c
index 3e4dc92e5..ffca6f317 100644
--- a/gio/tests/gdbus-threading.c
+++ b/gio/tests/gdbus-threading.c
@@ -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);
diff --git a/gio/tests/send-data.c b/gio/tests/send-data.c
index 514442976..a66976fa3 100644
--- a/gio/tests/send-data.c
+++ b/gio/tests/send-data.c
@@ -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) : "");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]