[geocode-glib/bilelmoussaoui/deprecated-api: 2/2] location: Stop using g_get_current_time()




commit e5905e15b8192570a5a4b16c91fa86178fabb18f
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Fri Jan 14 15:07:56 2022 +0100

    location: Stop using g_get_current_time()
    
    It is not 2038 safe, replace it with equivalent g_get_real_time().

 geocode-glib/geocode-location.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/geocode-glib/geocode-location.c b/geocode-glib/geocode-location.c
index 5be1711..3ff93ff 100644
--- a/geocode-glib/geocode-location.c
+++ b/geocode-glib/geocode-location.c
@@ -228,15 +228,15 @@ geocode_location_constructed (GObject *object)
 {
         GeocodeLocation *location = GEOCODE_LOCATION (object);
         GeocodeLocationPrivate *priv;
-        GTimeVal tv;
+        guint64 secs;
 
         priv = geocode_location_get_instance_private (location);
 
         if (priv->timestamp != 0)
                 return;
 
-        g_get_current_time (&tv);
-        geocode_location_set_timestamp (location, tv.tv_sec);
+        secs = g_get_real_time () / G_USEC_PER_SEC;
+        geocode_location_set_timestamp (location, secs);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]