[Xfce4-commits] [apps/xfce4-screensaver] 01/01: Fix the remaining GTimeVal deprecations

noreply at xfce.org noreply at xfce.org
Sun Mar 22 18:30:55 CET 2020


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit 8226d00f0952c45b2ba0f62b506631f1fd49766b
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Mar 22 13:30:22 2020 -0400

    Fix the remaining GTimeVal deprecations
---
 savers/floaters.c | 13 ++++++++++---
 src/xfce-bg.c     | 12 +++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/savers/floaters.c b/savers/floaters.c
index 17acd4c..74db455 100644
--- a/savers/floaters.c
+++ b/savers/floaters.c
@@ -870,10 +870,17 @@ static gdouble
 screen_saver_get_timestamp (ScreenSaver *screen_saver) {
     const gdouble microseconds_per_second = (gdouble ) G_USEC_PER_SEC;
     gdouble timestamp;
-    GTimeVal now = { 0L, /* zero-filled */ };
+    GDateTime *now;
+    gdouble now_sec;
+    gint now_usec;
 
-    g_get_current_time (&now);
-    timestamp = ((microseconds_per_second * now.tv_sec) + now.tv_usec) /
+    now = g_date_time_new_now_local ();
+    now_sec = g_date_time_to_unix (now);
+    now_usec = g_date_time_get_microsecond (now);
+
+    g_date_time_unref (now);
+
+    timestamp = ((microseconds_per_second * now_sec) + now_usec) /
                 microseconds_per_second;
 
     return timestamp;
diff --git a/src/xfce-bg.c b/src/xfce-bg.c
index e283359..4e178bf 100644
--- a/src/xfce-bg.c
+++ b/src/xfce-bg.c
@@ -1048,11 +1048,17 @@ struct _SlideShow {
 
 static double
 now (void) {
-    GTimeVal tv;
+    GDateTime *tv;
+    gdouble tv_sec;
+    gint tv_usec;
 
-    g_get_current_time (&tv);
+    tv = g_date_time_new_now_local ();
+    tv_sec = g_date_time_to_unix (tv);
+    tv_usec = g_date_time_get_microsecond (tv);
 
-    return (double)tv.tv_sec + (tv.tv_usec / 1000000.0);
+    g_date_time_unref (tv);
+
+    return (double)tv_sec + (tv_usec / 1000000.0);
 }
 
 static Slide *

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list