/* 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)
{
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 ++;
return 0;
}
-#define TIMEOUT 3
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>