source: rtems/testsuites/psxtests/psxclock01/init.c @ 56c7192

4.115
Last change on this file since 56c7192 was 56c7192, checked in by Gedare Bloom <gedare@…>, on 03/03/15 at 16:08:51

psxtests/psxclock01: use clock() and CLOCKS_PER_SEC

Closes #2182

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 * Copyright (C) 2015 Gedare Bloom.
3 *
4 * The license and distribution terms for this file may be
5 * found in the file LICENSE in this distribution or at
6 * http://www.rtems.com/license/LICENSE.
7 */
8
9#include <tmacros.h>
10#include "test_support.h"
11
12const char rtems_test_name[] = "PSXCLOCK01";
13#include <time.h>
14
15/* forward declarations to avoid warnings */
16void *POSIX_Init(void *argument);
17
18void *POSIX_Init(void *argument)
19{
20  clock_t start, end;
21  int diff = 0;
22
23  TEST_BEGIN();
24
25  start = clock();
26  end = 0;
27  if ( start >= 0 ) {
28    do {
29      end = clock();
30      diff = (int)(end - start)/CLOCKS_PER_SEC;
31    } while (diff < 1);
32  }
33
34  printf("Spun for %d second\n", diff);
35
36  TEST_END();
37  rtems_test_exit(0);
38}
39
40/* configuration information */
41
42#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
43#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
44#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
45#define CONFIGURE_MAXIMUM_POSIX_THREADS     2
46#define CONFIGURE_POSIX_INIT_THREAD_TABLE
47
48#define CONFIGURE_INIT
49#include <rtems/confdefs.h>
50/* end of file */
Note: See TracBrowser for help on using the repository browser.