]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/pair_content.c
ncurses 6.4 - patch 20240420
[ncurses.git] / test / pair_content.c
index 07651807b845add718adcef34b20c7f47f2c49d3..2b759a82466d486b14908f82f417b6a76578738e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2018-2020,2022 Thomas E. Dickey                                *
+ * Copyright 2018-2022,2023 Thomas E. Dickey                                *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: pair_content.c,v 1.20 2022/12/04 00:40:11 tom Exp $
+ * $Id: pair_content.c,v 1.22 2023/02/25 16:43:56 tom Exp $
  */
 
 #define NEED_TIME_H
@@ -57,10 +57,8 @@ static int x_opt;
 
 static MYPAIR *expected;
 
-#if HAVE_GETTIMEOFDAY
-static struct timeval initial_time;
-static struct timeval finish_time;
-#endif
+static TimeType initial_time;
+static TimeType finish_time;
 
 static GCC_NORETURN void
 finish(int code)
@@ -171,9 +169,7 @@ setup_test(void)
     } else {
        failed("This demo requires a color terminal");
     }
-#if HAVE_GETTIMEOFDAY
-    gettimeofday(&initial_time, 0);
-#endif
+    GetClockTime(&initial_time);
 }
 
 static void
@@ -206,16 +202,6 @@ finish_test(void)
     endwin();
 }
 
-#if HAVE_GETTIMEOFDAY
-static double
-seconds(struct timeval *mark)
-{
-    double result = (double) mark->tv_sec;
-    result += ((double) mark->tv_usec / 1e6);
-    return result;
-}
-#endif
-
 static void
 usage(int ok)
 {
@@ -246,7 +232,7 @@ VERSION_COMMON()
 /* *INDENT-ON* */
 
 int
-main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+main(int argc, char *argv[])
 {
     int ch;
 
@@ -321,12 +307,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
            addch('\n');
        }
        printw("DONE: ");
-#if HAVE_GETTIMEOFDAY
-       gettimeofday(&finish_time, 0);
-       printw("%.03f seconds",
-              seconds(&finish_time)
-              - seconds(&initial_time));
-#endif
+       GetClockTime(&finish_time);
+       printw("%.03f seconds", ElapsedSeconds(&initial_time, &finish_time));
        finish_test();
     }