[gnome-online-accounts/wip/rishi/drop-deprecated-gtimeval-gmemmove: 4/4] utils: Use g_get_real_time instead of deprecated g_get_current_time
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/drop-deprecated-gtimeval-gmemmove: 4/4] utils: Use g_get_real_time instead of deprecated g_get_current_time
- Date: Wed, 4 Dec 2019 15:30:26 +0000 (UTC)
commit 2225484bda6170ffcb29d4a0c5989e4eda3755cf
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Dec 4 16:28:16 2019 +0100
utils: Use g_get_real_time instead of deprecated g_get_current_time
https://gitlab.gnome.org/GNOME/gnome-online-accounts/merge_requests/37
src/goabackend/goautils.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index d0863554..b23a2585 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -254,11 +254,11 @@ goa_utils_check_duplicate (GoaClient *client,
gint
goa_utils_convert_abs_usec_to_duration_sec (gint64 abs_usec)
{
+ gint64 now;
gint64 ret;
- GTimeVal now;
- g_get_current_time (&now);
- ret = abs_usec - (((gint64) now.tv_sec) * 1000L * 1000L + ((gint64) now.tv_usec));
+ now = g_get_real_time ();
+ ret = abs_usec - now;
ret /= 1000L * 1000L;
return (gint) ret;
}
@@ -266,12 +266,11 @@ goa_utils_convert_abs_usec_to_duration_sec (gint64 abs_usec)
gint64
goa_utils_convert_duration_sec_to_abs_usec (gint duration_sec)
{
+ gint64 now;
gint64 ret;
- GTimeVal now;
- g_get_current_time (&now);
- ret = ((gint64) now.tv_sec) * 1000L * 1000L + ((gint64) now.tv_usec);
- ret += ((gint64) duration_sec) * 1000L * 1000L;
+ now = g_get_real_time ();
+ ret = now + ((gint64) duration_sec) * 1000L * 1000L;
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]