[libgit2-glib] tests: Replace use of deprecated GTimeVal



commit 7c0f4340b9a7514a92f24066a6200d802675fb12
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date:   Sun Mar 1 17:31:10 2020 +0000

    tests: Replace use of deprecated GTimeVal
    
    Replace the deprecated g_get_current_time with g_get_real_time. Adjust
    the value calculation so it remains the same.

 tests/repository.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/repository.c b/tests/repository.c
index 7396ef7..c1d9a43 100644
--- a/tests/repository.c
+++ b/tests/repository.c
@@ -73,7 +73,7 @@ _g_mkdtemp (gchar *tmpl)
        static const int NLETTERS = sizeof (letters) - 1;
        static int counter = 0;
        char *XXXXXX;
-       GTimeVal tv;
+       gint64 time;
        glong value;
        int count;
 
@@ -87,8 +87,8 @@ _g_mkdtemp (gchar *tmpl)
        }
 
        /* Get some more or less random data.  */
-       g_get_current_time (&tv);
-       value = (tv.tv_usec ^ tv.tv_sec) + counter++;
+       time = g_get_real_time ();
+       value = ((time % G_USEC_PER_SEC) ^ (time / G_USEC_PER_SEC)) + counter++;
 
        for (count = 0; count < 100; value += 7777, ++count)
        {


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