]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - time/tst-ftime.c
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / time / tst-ftime.c
index 74e6d1cea33640d1922a1df2f96f5a6a766eeef9..0b982eef7f205edb6f928f3d29c6fba9a2081bb4 100644 (file)
@@ -1,5 +1,5 @@
 /* Verify that ftime is sane.
-   Copyright (C) 2014-2018 Free Software Foundation, Inc.
+   Copyright (C) 2014-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
+#include <features.h>
 #include <sys/timeb.h>
-#include <stdio.h>
+#include <libc-diag.h>
+
+#include <support/check.h>
 
 static int
 do_test (void)
@@ -29,24 +32,18 @@ do_test (void)
     {
       prev = curr;
 
-      if (ftime (&curr))
-        {
-          printf ("ftime returned an error\n");
-          return 1;
-        }
-
-      if (curr.time < prev.time)
-        {
-          printf ("ftime's time flowed backwards\n");
-          return 1;
-        }
-
-      if (curr.time == prev.time
-          && curr.millitm < prev.millitm)
-        {
-          printf ("ftime's millitm flowed backwards\n");
-          return 1;
-        }
+      /* ftime was deprecated on 2.31.  */
+      DIAG_PUSH_NEEDS_COMMENT;
+      DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+      TEST_COMPARE (ftime (&curr), 0);
+
+      DIAG_POP_NEEDS_COMMENT;
+
+      TEST_VERIFY (curr.time >= prev.time);
+
+      if (curr.time == prev.time)
+       TEST_VERIFY (curr.millitm >= prev.millitm);
 
       if (curr.time > prev.time)
         sec ++;
@@ -54,6 +51,4 @@ do_test (void)
   return 0;
 }
 
-#define TIMEOUT 3
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>