source: rtems/c/src/tests/sptests/sp03/task1.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*  Task_1
2 *
3 *  This routine serves as a test task.  It verifies the capability to
4 *  set and read the executives calender and clock.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 *  All rights assigned to U.S. Government, 1994.
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24rtems_task Task_1(
25  rtems_task_argument argument
26)
27{
28  rtems_status_code status;
29  rtems_time_of_day time;
30
31  build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
32
33  status = rtems_clock_set( &time );
34  directive_failed( status, "rtems_clock_set" );
35
36  put_name( Task_name[ 1 ], FALSE );
37  print_time( " sets clock: ", &time, "\n" );
38
39  while( FOREVER ) {
40    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
41    directive_failed( status, "rtems_clock_get" );
42
43    put_name( Task_name[ 1 ], FALSE );
44    print_time( " going to sleep:  ", &time, "\n" );
45
46    time.second += 5;
47    time.minute += ( time.second / 60 );
48    time.second %= 60;
49    time.hour += ( time.minute / 60 );
50    time.minute %= 60;
51    time.hour %= 24;
52
53    status = rtems_task_wake_when( &time );
54    directive_failed( status, "rtems_task_wake_when" );
55
56    put_name( Task_name[ 1 ], FALSE );
57    print_time( " awakened:  ", &time, "\n" );
58  }
59}
Note: See TracBrowser for help on using the repository browser.