source: rtems/testsuites/psxtests/psxusleep/init.c @ 6c2de60

4.115
Last change on this file since 6c2de60 was 6c2de60, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/12 at 19:12:11

psxtests - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <pmacros.h>
15#include <time.h>
16#include <errno.h>
17
18/* forward declarations to avoid warnings */
19rtems_task Init(rtems_task_argument argument);
20
21rtems_task Init(
22  rtems_task_argument argument
23)
24{
25  struct tm       tm;
26  struct timespec tv;
27  useconds_t      remaining;
28  int             sc;
29
30  puts( "\n\n*** POSIX USLEEP TEST ***" );
31
32  tm_build_time( &tm, TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
33
34  /* set the time of day, and print our buffer in multiple ways */
35
36  tv.tv_nsec = 0;
37  tv.tv_sec = mktime( &tm );
38  rtems_test_assert( tv.tv_sec != -1 );
39
40  /* now set the time of day */
41
42  printf( asctime( &tm ) );
43  puts( "Init: clock_settime - SUCCESSFUL" );
44  sc = clock_settime( CLOCK_REALTIME, &tv );
45  rtems_test_assert( !sc );
46
47  printf( asctime( &tm ) );
48  printf( ctime( &tv.tv_sec ) );
49
50  /* use sleep to delay */
51
52  remaining = usleep( 3 * 1000000 );
53  rtems_test_assert( !remaining );
54
55  sc = clock_gettime( CLOCK_REALTIME, &tv );
56  rtems_test_assert( !sc );
57
58  printf( ctime( &tv.tv_sec ) );
59
60  puts( "*** END OF POSIX USLEEP TEST ***" );
61  rtems_test_exit(0);
62}
63
64
65/* configuration information */
66#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
67#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
68
69#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
70#define CONFIGURE_MAXIMUM_TASKS             1
71
72#define CONFIGURE_INIT
73#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.