source: rtems/testsuites/sptests/spclockget/init.c @ c0c2d49

4.104.115
Last change on this file since c0c2d49 was c0c2d49, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/26/09 at 17:04:39

Use PRIdrtems_interval to print rtems_interval's.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
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 *  $Id$
10 */
11
12#include <tmacros.h>
13
14rtems_task Init(
15  rtems_task_argument ignored
16)
17{
18  rtems_status_code   sc;
19  rtems_time_of_day   time;
20  rtems_interval      interval;
21  struct timeval      timev;
22
23  puts( "\n\n*** TEST LEGACY RTEMS_CLOCK_GET ***" );
24
25  puts( "Init - clock_set_time" );
26  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
27  sc = rtems_clock_set( &time );
28  directive_failed( sc, "rtems_clock_set" );
29
30  sc = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
31  directive_failed( sc, "rtems_clock_get -- TOD" );
32  print_time( "Init - rtems_clock_get - ", &time, "\n" );
33 
34  sc = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &interval );
35  directive_failed( sc, "rtems_clock_get -- Seconds Since Epoch" );
36  printf( "Init - rtems_clock_get - Seconds Since Epoch = %" PRIdrtems_interval "\n", interval );
37 
38  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &interval );
39  directive_failed( sc, "rtems_clock_get -- Ticks Since Boot" );
40  printf( "Init - rtems_clock_get - Ticks Since Boot = %" PRIdrtems_interval "\n", interval );
41 
42  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &interval );
43  directive_failed( sc, "rtems_clock_get -- Ticks Per Second" );
44  printf( "Init - rtems_clock_get - Ticks Per Second = %" PRIdrtems_interval "\n", interval );
45 
46  sc = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &timev );
47  directive_failed( sc, "rtems_clock_get -- Time Value" );
48  printf( "Init - rtems_clock_get - Time Value = %" PRItime_t "\n", timev.tv_sec );
49 
50  puts( "*** END OF TEST LEGACY RTEMS_CLOCK_GET ***" );
51  rtems_test_exit(0);
52}
53
54/* configuration information */
55
56#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
57#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
58
59#define CONFIGURE_MAXIMUM_TASKS         1
60#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
61
62#define CONFIGURE_INIT
63#include <rtems/confdefs.h>
64
65/* global variables */
Note: See TracBrowser for help on using the repository browser.