Index: c/src/tests/sptests/ChangeLog
===================================================================
--- c/src/tests/sptests/ChangeLog	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ c/src/tests/sptests/ChangeLog	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -1,2 +1,15 @@
+2001-01-16	Joel Sherrill <joel@OARcorp.com>
+
+	* Added tests for task-based timers.  This included the new tests
+	sp30 and sp31.
+	* Makefile.am, configure.ac: Modified to reflect new tests and files.
+	* sp09/screen14.c, sp09/sp09.scn: Modified to add error checks
+	for task-based timer services.
+	* sp30/.cvsignore, sp30/Makefile.am, sp30/init.c, sp30/resume.c,
+	sp30/sp30.doc, sp30/sp30.scn, sp30/system.h, sp30/task1.c,
+	sp31/.cvsignore, sp31/Makefile.am, sp31/delay.c, sp31/init.c,
+	sp31/prtime.c, sp31/sp31.doc, sp31/sp31.scn, sp31/system.h,
+	sp31/task1.c: New files.
+
 2001-11-01	Joel Sherrill <joel@OARcorp.com>
 
Index: c/src/tests/sptests/Makefile.am
===================================================================
--- c/src/tests/sptests/Makefile.am	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ c/src/tests/sptests/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -9,5 +9,5 @@
 SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
     sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
-    spsize
+    sp30 sp31 spsize
 
 EXTRA_DIST = sptests.am spfatal
Index: c/src/tests/sptests/configure.ac
===================================================================
--- c/src/tests/sptests/configure.ac	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ c/src/tests/sptests/configure.ac	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -67,4 +67,6 @@
 sp28/Makefile
 sp29/Makefile
+sp30/Makefile
+sp31/Makefile
 spsize/Makefile
 ])
Index: c/src/tests/sptests/sp09/screen14.c
===================================================================
--- c/src/tests/sptests/sp09/screen14.c	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ c/src/tests/sptests/sp09/screen14.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -151,3 +151,85 @@
     " - before RTEMS_INVALID_CLOCK\n"
   );
+
+/* timer server interface routines */
+
+  status = rtems_timer_server_fire_after( 0, 5, NULL, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INCORRECT_STATE,
+    "rtems_timer_server_fire_after incorrect state"
+  );
+  puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE" );
+
+  status = rtems_timer_server_fire_when( 0, &time, NULL, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INCORRECT_STATE,
+    "rtems_timer_server_fire_when incorrect state"
+  );
+  puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE" );
+
+  status = rtems_timer_initiate_server( 0, 0 );
+  directive_failed( status, "rtems_timer_initiate_server" );
+  puts( "TA1 - rtems_timer_initiate_server" );
+  
+  status = rtems_timer_server_fire_after(
+    0x010100,
+    5 * TICKS_PER_SECOND,
+    Delayed_routine,
+    NULL
+  );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_ID,
+    "rtems_timer_server_fire_after illegal id"
+  );
+  puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID" );
+
+  build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
+  status = rtems_timer_server_fire_when( 0x010100, &time, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_ID,
+    "rtems_timer_server_fire_when with illegal id"
+  );
+  puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID" );
+
+  status = rtems_timer_server_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_NUMBER,
+    "rtems_timer_server_fire_after with 0 ticks"
+  );
+  puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER" );
+
+  build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
+  status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_CLOCK,
+    "rtems_timer_server_fire_when with illegal time"
+  );
+  print_time(
+    "TA1 - rtems_timer_server_fire_when - ",
+    &time,
+    " - RTEMS_INVALID_CLOCK\n"
+  );
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_set" );
+  print_time( "TA1 - rtems_clock_get       - ", &time, "\n" );
+
+  build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
+  status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_CLOCK,
+    "rtems_timer_server_fire_when before current time"
+  );
+  print_time(
+    "TA1 - rtems_timer_server_fire_when - ",
+    &time,
+    " - before RTEMS_INVALID_CLOCK\n"
+  );
 }
Index: c/src/tests/sptests/sp09/sp09.scn
===================================================================
--- c/src/tests/sptests/sp09/sp09.scn	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ c/src/tests/sptests/sp09/sp09.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -247,5 +247,14 @@
 TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER
 TA1 - rtems_timer_fire_when - 08:30:45   02/05/1987 - RTEMS_INVALID_CLOCK
-TA1 - rtems_clock_get       - 00:00:00   01/01/1992
+TA1 - rtems_clock_get       - 00:00:01   01/01/1992
 TA1 - rtems_timer_fire_when - 08:30:45   02/05/1990 - before RTEMS_INVALID_CLOCK
+TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE
+TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE
+TA1 - rtems_timer_initiate_server
+TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID
+TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID
+TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER
+TA1 - rtems_timer_server_fire_when - 08:30:45   02/05/1987 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_get       - 00:00:01   01/01/1992
+TA1 - rtems_timer_server_fire_when - 08:30:45   02/05/1990 - before RTEMS_INVALID_CLOCK
 *** END OF TEST 9 ***
Index: c/src/tests/sptests/sp30/.cvsignore
===================================================================
--- c/src/tests/sptests/sp30/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: c/src/tests/sptests/sp30/Makefile.am
===================================================================
--- c/src/tests/sptests/sp30/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,36 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+TEST = sp30
+
+MANAGERS = all
+
+C_FILES = init.c resume.c task1.c
+C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
+
+DOCTYPES = scn
+DOCS = $(DOCTYPES:%=$(TEST).%)
+
+SRCS = $(C_FILES) $(H_FILES)
+OBJS = $(C_O_FILES)
+
+PRINT_SRCS = $(DOCS)
+
+PGM = ${ARCH}/$(TEST).exe
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../automake/compile.am
+include $(top_srcdir)/../../../../automake/leaf.am
+include $(top_srcdir)/sptests.am
+
+${PGM}: $(OBJS) $(LINK_FILES)
+	$(make-exe)
+
+all-local: $(ARCH) $(TMPINSTALL_FILES)
+
+EXTRA_DIST = $(C_FILES) $(DOCS)
+
+include $(top_srcdir)/../../../../automake/local.am
Index: c/src/tests/sptests/sp30/init.c
===================================================================
--- c/src/tests/sptests/sp30/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,81 @@
+/*  Init
+ *
+ *  This routine is the initialization task for this test program.
+ *  It is a user initialization task and has the responsibility for creating
+ *  and starting the tasks that make up the test.  If the time of day
+ *  clock is required for the test, it should also be set to a known
+ *  value by this function.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_time_of_day time;
+  rtems_unsigned32  index;
+  rtems_status_code status;
+
+  puts( "\n\n*** TEST 30 ***" );
+
+  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+  status = rtems_clock_set( &time );
+  directive_failed( status, "rtems_clock_set" );
+
+  status = rtems_timer_initiate_server(
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_ATTRIBUTES
+  );
+  directive_failed( status, "rtems_timer_initiate_server" );
+
+  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
+  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
+
+  Timer_name[ 1 ] =  rtems_build_name( 'T', 'M', '1', ' ' );
+  Timer_name[ 2 ] =  rtems_build_name( 'T', 'M', '2', ' ' );
+  Timer_name[ 3 ] =  rtems_build_name( 'T', 'M', '3', ' ' );
+
+  for ( index = 1 ; index <= 3 ; index++ ) {
+    status = rtems_task_create(
+      Task_name[ index ],
+      1,
+      RTEMS_MINIMUM_STACK_SIZE * 2,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &Task_id[ index ]
+    );
+    directive_failed( status, "rtems_task_create loop" );
+
+    status = rtems_timer_create(
+      Timer_name[ index ],
+      &Timer_id[ index ]
+    );
+    directive_failed( status, "rtems_timer_create loop" );
+  }
+
+  for ( index = 1 ; index <= 3 ; index++ ) {
+    status = rtems_task_start( Task_id[ index ], Task_1_through_3, index );
+    directive_failed( status, "rtems_task_start loop" );
+  }
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
Index: c/src/tests/sptests/sp30/resume.c
===================================================================
--- c/src/tests/sptests/sp30/resume.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/resume.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,33 @@
+/*  Resume_task
+ *
+ *  This subprogram is scheduled as a timer service routine.  When
+ *  it fires it resumes the task which is mapped to this timer.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Resume_task(
+  rtems_id  timer_id,
+  void     *ignored_address
+)
+{
+  rtems_id          task_to_resume;
+  rtems_status_code status;
+
+  task_to_resume = Task_id[ rtems_get_index( timer_id ) ];
+  status = rtems_task_resume( task_to_resume );
+  directive_failed_with_level( status, "rtems_task_resume", 1 );
+}
Index: c/src/tests/sptests/sp30/sp30.scn
===================================================================
--- c/src/tests/sptests/sp30/sp30.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/sp30.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,16 @@
+*** TEST 30 ***
+TA1  - rtems_clock_get - 09:00:00   12/31/1988
+TA2  - rtems_clock_get - 09:00:00   12/31/1988
+TA3  - rtems_clock_get - 09:00:00   12/31/1988
+TA1  - rtems_clock_get - 09:00:05   12/31/1988
+TA2  - rtems_clock_get - 09:00:10   12/31/1988
+TA1  - rtems_clock_get - 09:00:10   12/31/1988
+TA3  - rtems_clock_get - 09:00:15   12/31/1988
+TA1  - rtems_clock_get - 09:00:15   12/31/1988
+TA2  - rtems_clock_get - 09:00:20   12/31/1988
+TA1  - rtems_clock_get - 09:00:20   12/31/1988
+TA1  - rtems_clock_get - 09:00:25   12/31/1988
+TA3  - rtems_clock_get - 09:00:30   12/31/1988
+TA2  - rtems_clock_get - 09:00:30   12/31/1988
+TA1  - rtems_clock_get - 09:00:30   12/31/1988
+*** END OF TEST 30 ***
Index: c/src/tests/sptests/sp30/system.h
===================================================================
--- c/src/tests/sptests/sp30/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,55 @@
+/*  system.h
+ *
+ *  This include file contains information that is included in every
+ *  function in the test set.
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+ 
+rtems_timer_service_routine Resume_task(
+  rtems_id  timer_id,
+  void     *ignored_address
+);
+ 
+rtems_task Task_1_through_3(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS               5
+#define CONFIGURE_MAXIMUM_TIMERS              3
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS           (3 * RTEMS_MINIMUM_STACK_SIZE)
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
+
+TEST_EXTERN rtems_id   Timer_id[ 4 ];     /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ];   /* array of timer names */
+
+/* end of include file */
Index: c/src/tests/sptests/sp30/task1.c
===================================================================
--- c/src/tests/sptests/sp30/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp30/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,57 @@
+/*  Task_1_through_3
+ *
+ *  This task is a cyclic version of test1 to asssure that the times
+ *  displayed are not skewed as in test1.  "TA1" is printed once every
+ *  5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is
+ *  printed once every 15 seconds.  The times displayed should be
+ *  in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively.
+ *  If the times are skewed from these values, then the calendar time
+ *  does not correspond correctly with the number of ticks.
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+  rtems_task_argument argument
+)
+{
+  rtems_id          tid;
+  rtems_time_of_day time;
+  rtems_status_code status;
+
+  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  directive_failed( status, "rtems_task_ident of self" );
+
+  while ( FOREVER )  {
+    status = rtems_timer_server_fire_after(
+      Timer_id[ argument ],
+      task_number( tid ) * 5 * TICKS_PER_SECOND,
+      Resume_task,
+      NULL
+    );
+    directive_failed( status, "rtems_timer_server_fire_after failed" );
+
+    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+    directive_failed( status, "rtems_clock_get failed" );
+
+    if ( time.second >= 35 ) {
+      puts( "*** END OF TEST 30 ***" );
+      exit( 0 );
+    }
+
+    put_name( Task_name[ task_number( tid ) - 1 ], FALSE );
+    print_time( " - rtems_clock_get - ", &time, "\n" );
+
+    status = rtems_task_suspend( RTEMS_SELF );
+    directive_failed( status, "rtems_task_suspend" );
+  }
+}
Index: c/src/tests/sptests/sp31/.cvsignore
===================================================================
--- c/src/tests/sptests/sp31/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: c/src/tests/sptests/sp31/Makefile.am
===================================================================
--- c/src/tests/sptests/sp31/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,36 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+TEST = sp31
+
+MANAGERS = all
+
+C_FILES = delay.c init.c prtime.c task1.c
+C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
+
+DOCTYPES = scn
+DOCS = $(DOCTYPES:%=$(TEST).%)
+
+SRCS = $(C_FILES) $(H_FILES)
+OBJS = $(C_O_FILES)
+
+PRINT_SRCS = $(DOCS)
+
+PGM = ${ARCH}/$(TEST).exe
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../automake/compile.am
+include $(top_srcdir)/../../../../automake/leaf.am
+include $(top_srcdir)/sptests.am
+
+${PGM}: $(OBJS) $(LINK_FILES)
+	$(make-exe)
+
+all-local: $(ARCH) $(TMPINSTALL_FILES)
+
+EXTRA_DIST = $(C_FILES) $(DOCS)
+
+include $(top_srcdir)/../../../../automake/local.am
Index: c/src/tests/sptests/sp31/delay.c
===================================================================
--- c/src/tests/sptests/sp31/delay.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/delay.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,31 @@
+/*  Delayed_resume
+ *
+ *  This routine is scheduled to be fired as a timer service routine.
+ *  When fired this subprogram resumes Task_1.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_resume(
+  rtems_id  ignored_id,
+  void     *ignored_address
+)
+{
+  rtems_status_code status;
+
+  status = rtems_task_resume( Task_id[ 1 ] );
+  directive_failed_with_level( status, "rtems_task_resume of self", 1 );
+}
Index: c/src/tests/sptests/sp31/init.c
===================================================================
--- c/src/tests/sptests/sp31/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,71 @@
+/*  Init
+ *
+ *  This routine is the initialization task for this test program.
+ *  It is a user initialization task and has the responsibility for creating
+ *  and starting the tasks that make up the test.  If the time of day
+ *  clock is required for the test, it should also be set to a known
+ *  value by this function.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_time_of_day  time;
+  rtems_status_code  status;
+
+  puts( "\n\n*** TEST 31 ***" );
+
+  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+  status = rtems_clock_set( &time );
+  directive_failed( status, "rtems_clock_set" );
+
+  status = rtems_timer_initiate_server(
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_ATTRIBUTES
+  );
+  directive_failed( status, "rtems_timer_initiate_server" );
+
+  Task_name[ 1 ]  = rtems_build_name( 'T', 'A', '1', ' ' );
+  Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+  status = rtems_task_create(
+    Task_name[ 1 ],
+    1,
+    RTEMS_MINIMUM_STACK_SIZE * 2,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &Task_id[ 1 ]
+  );
+  directive_failed( status, "rtems_task_create of TA1" );
+
+  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+  directive_failed( status, "rtems_task_start of TA1" );
+
+  puts( "INIT - rtems_timer_create - creating timer 1" );
+  status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+  directive_failed( status, "rtems_timer_create" );
+
+  printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
Index: c/src/tests/sptests/sp31/prtime.c
===================================================================
--- c/src/tests/sptests/sp31/prtime.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/prtime.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,31 @@
+/*  Print_time
+ *
+ *  This routine prints the name of Task_1 and the current time of day.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+void Print_time( void )
+{
+  rtems_time_of_day time;
+  rtems_status_code status;
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_get" );
+
+  put_name( Task_name[ 1 ], FALSE );
+  print_time( "- rtems_clock_get - ", &time, "\n" );
+}
Index: c/src/tests/sptests/sp31/sp31.scn
===================================================================
--- c/src/tests/sptests/sp31/sp31.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/sp31.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,29 @@
+*** TEST 31 ***
+INIT - rtems_timer_create - creating timer 1
+INIT - timer 1 has id (0x14010001)
+TA1 - rtems_timer_ident - identing timer 1
+TA1 - timer 1 has id (0x14010001)
+TA1 - rtems_clock_get - 09:00:00   12/31/1988
+TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:03   12/31/1988
+TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:04   12/31/1988
+TA1 - rtems_timer_reset - timer 1
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:07   12/31/1988
+<pause>
+TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_clock_get - 09:00:07   12/31/1988
+TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:10   12/31/1988
+TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:11   12/31/1988
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_task_wake_after - YIELD (only task at priority)
+TA1 - timer_deleting - timer 1
+*** END OF TEST 31 ***
Index: c/src/tests/sptests/sp31/system.h
===================================================================
--- c/src/tests/sptests/sp31/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,58 @@
+/*  system.h
+ *
+ *  This include file contains information that is included in every
+ *  function in the test set.
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+ 
+rtems_timer_service_routine Delayed_resume(
+  rtems_id  ignored_id,
+  void     *ignored_address
+);
+ 
+void Print_time( void );
+ 
+rtems_task Task_1(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS           3
+#define CONFIGURE_MAXIMUM_TIMERS          2
+#define CONFIGURE_INIT_TASK_STACK_SIZE    (RTEMS_MINIMUM_STACK_SIZE * 2)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS       (1 * RTEMS_MINIMUM_STACK_SIZE)
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
+
+TEST_EXTERN rtems_id   Timer_id[ 2 ];    /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ];  /* array of timer names */
+
+/* end of include file */
Index: c/src/tests/sptests/sp31/task1.c
===================================================================
--- c/src/tests/sptests/sp31/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ c/src/tests/sptests/sp31/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,163 @@
+/*  Task_1
+ *
+ *  This routine serves as a test task.  It verifies the basic task
+ *  switching capabilities of the executive.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+  rtems_task_argument argument
+)
+{
+  rtems_id          tmid;
+  rtems_time_of_day time;
+  rtems_status_code status;
+
+/* Get id */
+
+  puts( "TA1 - rtems_timer_ident - identing timer 1" );
+  status = rtems_timer_ident( Timer_name[ 1 ], &tmid );
+  directive_failed( status, "rtems_timer_ident" );
+  printf( "TA1 - timer 1 has id (0x%x)\n", tmid );
+
+/* after which is allowed to fire */
+
+  Print_time();
+
+  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_after(
+    tmid,
+    3 * TICKS_PER_SECOND,
+    Delayed_resume,
+    NULL
+  );
+  directive_failed( status, "rtems_timer_server_fire_after" );
+
+  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
+
+  Print_time();
+
+/* after which is reset and allowed to fire */
+
+  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_after(
+    tmid,
+    3 * TICKS_PER_SECOND,
+    Delayed_resume,
+    NULL
+  );
+  directive_failed( status, "rtems_timer_server_fire_after" );
+
+  puts( "TA1 - rtems_task_wake_after - 1 second" );
+  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+  directive_failed( status, "rtems_task_wake_after" );
+
+  Print_time();
+
+  puts( "TA1 - rtems_timer_reset - timer 1" );
+  status = rtems_timer_reset( tmid );
+  directive_failed( status, "rtems_timer_reset" );
+
+  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
+
+  Print_time();
+
+  rtems_test_pause();
+
+  /*
+   *  Reset the time since we do not know how long the user waited
+   *  before pressing <cr> at the pause.  This insures that the 
+   *  actual output matches the screen.
+   */
+
+  build_time( &time, 12, 31, 1988, 9, 0, 7, 0 );
+
+  status = rtems_clock_set( &time );
+  directive_failed( status, "rtems_clock_set" );
+
+/* after which is canceled */
+
+  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_after(
+    tmid,
+    3 * TICKS_PER_SECOND,
+    Delayed_resume,
+    NULL
+  );
+  directive_failed( status, "rtems_timer_server_fire_after" );
+
+  puts( "TA1 - rtems_timer_cancel - timer 1" );
+  status = rtems_timer_cancel( tmid );
+  directive_failed( status, "rtems_timer_cancel" );
+
+/* when which is allowed to fire */
+
+  Print_time();
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_get" );
+
+  time.second += 3;
+
+  puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_when( tmid, &time, Delayed_resume, NULL );
+  directive_failed( status, "rtems_timer_server_fire_when" );
+
+  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
+
+  Print_time();
+
+/* when which is canceled */
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_get" );
+
+  time.second += 3;
+
+  puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_when( tmid, &time, Delayed_resume, NULL );
+  directive_failed( status, "rtems_timer_server_fire_when" );
+
+  puts( "TA1 - rtems_task_wake_after - 1 second" );
+  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+  directive_failed( status, "rtems_task_wake_after" );
+
+  Print_time();
+
+  puts( "TA1 - rtems_timer_cancel - timer 1" );
+  status = rtems_timer_cancel( tmid );
+  directive_failed( status, "rtems_timer_cancel" );
+
+/* delete */
+  puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" );
+  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  directive_failed( status, "rtems_task_wake_after" );
+
+  puts( "TA1 - timer_deleting - timer 1" );
+  status = rtems_timer_delete( tmid );
+  directive_failed( status, "rtems_timer_delete" );
+
+  puts( "*** END OF TEST 31 *** " );
+  exit( 0 );
+}
Index: testsuites/sptests/ChangeLog
===================================================================
--- testsuites/sptests/ChangeLog	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ testsuites/sptests/ChangeLog	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -1,2 +1,15 @@
+2001-01-16	Joel Sherrill <joel@OARcorp.com>
+
+	* Added tests for task-based timers.  This included the new tests
+	sp30 and sp31.
+	* Makefile.am, configure.ac: Modified to reflect new tests and files.
+	* sp09/screen14.c, sp09/sp09.scn: Modified to add error checks
+	for task-based timer services.
+	* sp30/.cvsignore, sp30/Makefile.am, sp30/init.c, sp30/resume.c,
+	sp30/sp30.doc, sp30/sp30.scn, sp30/system.h, sp30/task1.c,
+	sp31/.cvsignore, sp31/Makefile.am, sp31/delay.c, sp31/init.c,
+	sp31/prtime.c, sp31/sp31.doc, sp31/sp31.scn, sp31/system.h,
+	sp31/task1.c: New files.
+
 2001-11-01	Joel Sherrill <joel@OARcorp.com>
 
Index: testsuites/sptests/Makefile.am
===================================================================
--- testsuites/sptests/Makefile.am	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ testsuites/sptests/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -9,5 +9,5 @@
 SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
     sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
-    spsize
+    sp30 sp31 spsize
 
 EXTRA_DIST = sptests.am spfatal
Index: testsuites/sptests/configure.ac
===================================================================
--- testsuites/sptests/configure.ac	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ testsuites/sptests/configure.ac	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -67,4 +67,6 @@
 sp28/Makefile
 sp29/Makefile
+sp30/Makefile
+sp31/Makefile
 spsize/Makefile
 ])
Index: testsuites/sptests/sp09/screen14.c
===================================================================
--- testsuites/sptests/sp09/screen14.c	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ testsuites/sptests/sp09/screen14.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -151,3 +151,85 @@
     " - before RTEMS_INVALID_CLOCK\n"
   );
+
+/* timer server interface routines */
+
+  status = rtems_timer_server_fire_after( 0, 5, NULL, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INCORRECT_STATE,
+    "rtems_timer_server_fire_after incorrect state"
+  );
+  puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE" );
+
+  status = rtems_timer_server_fire_when( 0, &time, NULL, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INCORRECT_STATE,
+    "rtems_timer_server_fire_when incorrect state"
+  );
+  puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE" );
+
+  status = rtems_timer_initiate_server( 0, 0 );
+  directive_failed( status, "rtems_timer_initiate_server" );
+  puts( "TA1 - rtems_timer_initiate_server" );
+  
+  status = rtems_timer_server_fire_after(
+    0x010100,
+    5 * TICKS_PER_SECOND,
+    Delayed_routine,
+    NULL
+  );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_ID,
+    "rtems_timer_server_fire_after illegal id"
+  );
+  puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID" );
+
+  build_time( &time, 12, 31, 1994, 9, 0, 0, 0 );
+  status = rtems_timer_server_fire_when( 0x010100, &time, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_ID,
+    "rtems_timer_server_fire_when with illegal id"
+  );
+  puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID" );
+
+  status = rtems_timer_server_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_NUMBER,
+    "rtems_timer_server_fire_after with 0 ticks"
+  );
+  puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER" );
+
+  build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
+  status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_CLOCK,
+    "rtems_timer_server_fire_when with illegal time"
+  );
+  print_time(
+    "TA1 - rtems_timer_server_fire_when - ",
+    &time,
+    " - RTEMS_INVALID_CLOCK\n"
+  );
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_set" );
+  print_time( "TA1 - rtems_clock_get       - ", &time, "\n" );
+
+  build_time( &time, 2, 5, 1990, 8, 30, 45, 0 );
+  status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL );
+  fatal_directive_status(
+    status,
+    RTEMS_INVALID_CLOCK,
+    "rtems_timer_server_fire_when before current time"
+  );
+  print_time(
+    "TA1 - rtems_timer_server_fire_when - ",
+    &time,
+    " - before RTEMS_INVALID_CLOCK\n"
+  );
 }
Index: testsuites/sptests/sp09/sp09.scn
===================================================================
--- testsuites/sptests/sp09/sp09.scn	(revision c55df856aaba12355354374983fc1e69bb60373d)
+++ testsuites/sptests/sp09/sp09.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -247,5 +247,14 @@
 TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER
 TA1 - rtems_timer_fire_when - 08:30:45   02/05/1987 - RTEMS_INVALID_CLOCK
-TA1 - rtems_clock_get       - 00:00:00   01/01/1992
+TA1 - rtems_clock_get       - 00:00:01   01/01/1992
 TA1 - rtems_timer_fire_when - 08:30:45   02/05/1990 - before RTEMS_INVALID_CLOCK
+TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE
+TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE
+TA1 - rtems_timer_initiate_server
+TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID
+TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID
+TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER
+TA1 - rtems_timer_server_fire_when - 08:30:45   02/05/1987 - RTEMS_INVALID_CLOCK
+TA1 - rtems_clock_get       - 00:00:01   01/01/1992
+TA1 - rtems_timer_server_fire_when - 08:30:45   02/05/1990 - before RTEMS_INVALID_CLOCK
 *** END OF TEST 9 ***
Index: testsuites/sptests/sp30/.cvsignore
===================================================================
--- testsuites/sptests/sp30/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: testsuites/sptests/sp30/Makefile.am
===================================================================
--- testsuites/sptests/sp30/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,36 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+TEST = sp30
+
+MANAGERS = all
+
+C_FILES = init.c resume.c task1.c
+C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
+
+DOCTYPES = scn
+DOCS = $(DOCTYPES:%=$(TEST).%)
+
+SRCS = $(C_FILES) $(H_FILES)
+OBJS = $(C_O_FILES)
+
+PRINT_SRCS = $(DOCS)
+
+PGM = ${ARCH}/$(TEST).exe
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../automake/compile.am
+include $(top_srcdir)/../../../../automake/leaf.am
+include $(top_srcdir)/sptests.am
+
+${PGM}: $(OBJS) $(LINK_FILES)
+	$(make-exe)
+
+all-local: $(ARCH) $(TMPINSTALL_FILES)
+
+EXTRA_DIST = $(C_FILES) $(DOCS)
+
+include $(top_srcdir)/../../../../automake/local.am
Index: testsuites/sptests/sp30/init.c
===================================================================
--- testsuites/sptests/sp30/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,81 @@
+/*  Init
+ *
+ *  This routine is the initialization task for this test program.
+ *  It is a user initialization task and has the responsibility for creating
+ *  and starting the tasks that make up the test.  If the time of day
+ *  clock is required for the test, it should also be set to a known
+ *  value by this function.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_time_of_day time;
+  rtems_unsigned32  index;
+  rtems_status_code status;
+
+  puts( "\n\n*** TEST 30 ***" );
+
+  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+  status = rtems_clock_set( &time );
+  directive_failed( status, "rtems_clock_set" );
+
+  status = rtems_timer_initiate_server(
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_ATTRIBUTES
+  );
+  directive_failed( status, "rtems_timer_initiate_server" );
+
+  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
+  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
+
+  Timer_name[ 1 ] =  rtems_build_name( 'T', 'M', '1', ' ' );
+  Timer_name[ 2 ] =  rtems_build_name( 'T', 'M', '2', ' ' );
+  Timer_name[ 3 ] =  rtems_build_name( 'T', 'M', '3', ' ' );
+
+  for ( index = 1 ; index <= 3 ; index++ ) {
+    status = rtems_task_create(
+      Task_name[ index ],
+      1,
+      RTEMS_MINIMUM_STACK_SIZE * 2,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &Task_id[ index ]
+    );
+    directive_failed( status, "rtems_task_create loop" );
+
+    status = rtems_timer_create(
+      Timer_name[ index ],
+      &Timer_id[ index ]
+    );
+    directive_failed( status, "rtems_timer_create loop" );
+  }
+
+  for ( index = 1 ; index <= 3 ; index++ ) {
+    status = rtems_task_start( Task_id[ index ], Task_1_through_3, index );
+    directive_failed( status, "rtems_task_start loop" );
+  }
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
Index: testsuites/sptests/sp30/resume.c
===================================================================
--- testsuites/sptests/sp30/resume.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/resume.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,33 @@
+/*  Resume_task
+ *
+ *  This subprogram is scheduled as a timer service routine.  When
+ *  it fires it resumes the task which is mapped to this timer.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Resume_task(
+  rtems_id  timer_id,
+  void     *ignored_address
+)
+{
+  rtems_id          task_to_resume;
+  rtems_status_code status;
+
+  task_to_resume = Task_id[ rtems_get_index( timer_id ) ];
+  status = rtems_task_resume( task_to_resume );
+  directive_failed_with_level( status, "rtems_task_resume", 1 );
+}
Index: testsuites/sptests/sp30/sp30.scn
===================================================================
--- testsuites/sptests/sp30/sp30.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/sp30.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,16 @@
+*** TEST 30 ***
+TA1  - rtems_clock_get - 09:00:00   12/31/1988
+TA2  - rtems_clock_get - 09:00:00   12/31/1988
+TA3  - rtems_clock_get - 09:00:00   12/31/1988
+TA1  - rtems_clock_get - 09:00:05   12/31/1988
+TA2  - rtems_clock_get - 09:00:10   12/31/1988
+TA1  - rtems_clock_get - 09:00:10   12/31/1988
+TA3  - rtems_clock_get - 09:00:15   12/31/1988
+TA1  - rtems_clock_get - 09:00:15   12/31/1988
+TA2  - rtems_clock_get - 09:00:20   12/31/1988
+TA1  - rtems_clock_get - 09:00:20   12/31/1988
+TA1  - rtems_clock_get - 09:00:25   12/31/1988
+TA3  - rtems_clock_get - 09:00:30   12/31/1988
+TA2  - rtems_clock_get - 09:00:30   12/31/1988
+TA1  - rtems_clock_get - 09:00:30   12/31/1988
+*** END OF TEST 30 ***
Index: testsuites/sptests/sp30/system.h
===================================================================
--- testsuites/sptests/sp30/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,55 @@
+/*  system.h
+ *
+ *  This include file contains information that is included in every
+ *  function in the test set.
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+ 
+rtems_timer_service_routine Resume_task(
+  rtems_id  timer_id,
+  void     *ignored_address
+);
+ 
+rtems_task Task_1_through_3(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS               5
+#define CONFIGURE_MAXIMUM_TIMERS              3
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS           (3 * RTEMS_MINIMUM_STACK_SIZE)
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
+
+TEST_EXTERN rtems_id   Timer_id[ 4 ];     /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 4 ];   /* array of timer names */
+
+/* end of include file */
Index: testsuites/sptests/sp30/task1.c
===================================================================
--- testsuites/sptests/sp30/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp30/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,57 @@
+/*  Task_1_through_3
+ *
+ *  This task is a cyclic version of test1 to asssure that the times
+ *  displayed are not skewed as in test1.  "TA1" is printed once every
+ *  5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is
+ *  printed once every 15 seconds.  The times displayed should be
+ *  in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively.
+ *  If the times are skewed from these values, then the calendar time
+ *  does not correspond correctly with the number of ticks.
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1_through_3(
+  rtems_task_argument argument
+)
+{
+  rtems_id          tid;
+  rtems_time_of_day time;
+  rtems_status_code status;
+
+  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+  directive_failed( status, "rtems_task_ident of self" );
+
+  while ( FOREVER )  {
+    status = rtems_timer_server_fire_after(
+      Timer_id[ argument ],
+      task_number( tid ) * 5 * TICKS_PER_SECOND,
+      Resume_task,
+      NULL
+    );
+    directive_failed( status, "rtems_timer_server_fire_after failed" );
+
+    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+    directive_failed( status, "rtems_clock_get failed" );
+
+    if ( time.second >= 35 ) {
+      puts( "*** END OF TEST 30 ***" );
+      exit( 0 );
+    }
+
+    put_name( Task_name[ task_number( tid ) - 1 ], FALSE );
+    print_time( " - rtems_clock_get - ", &time, "\n" );
+
+    status = rtems_task_suspend( RTEMS_SELF );
+    directive_failed( status, "rtems_task_suspend" );
+  }
+}
Index: testsuites/sptests/sp31/.cvsignore
===================================================================
--- testsuites/sptests/sp31/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/.cvsignore	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: testsuites/sptests/sp31/Makefile.am
===================================================================
--- testsuites/sptests/sp31/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/Makefile.am	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,36 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+TEST = sp31
+
+MANAGERS = all
+
+C_FILES = delay.c init.c prtime.c task1.c
+C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
+
+DOCTYPES = scn
+DOCS = $(DOCTYPES:%=$(TEST).%)
+
+SRCS = $(C_FILES) $(H_FILES)
+OBJS = $(C_O_FILES)
+
+PRINT_SRCS = $(DOCS)
+
+PGM = ${ARCH}/$(TEST).exe
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../automake/compile.am
+include $(top_srcdir)/../../../../automake/leaf.am
+include $(top_srcdir)/sptests.am
+
+${PGM}: $(OBJS) $(LINK_FILES)
+	$(make-exe)
+
+all-local: $(ARCH) $(TMPINSTALL_FILES)
+
+EXTRA_DIST = $(C_FILES) $(DOCS)
+
+include $(top_srcdir)/../../../../automake/local.am
Index: testsuites/sptests/sp31/delay.c
===================================================================
--- testsuites/sptests/sp31/delay.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/delay.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,31 @@
+/*  Delayed_resume
+ *
+ *  This routine is scheduled to be fired as a timer service routine.
+ *  When fired this subprogram resumes Task_1.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_timer_service_routine Delayed_resume(
+  rtems_id  ignored_id,
+  void     *ignored_address
+)
+{
+  rtems_status_code status;
+
+  status = rtems_task_resume( Task_id[ 1 ] );
+  directive_failed_with_level( status, "rtems_task_resume of self", 1 );
+}
Index: testsuites/sptests/sp31/init.c
===================================================================
--- testsuites/sptests/sp31/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/init.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,71 @@
+/*  Init
+ *
+ *  This routine is the initialization task for this test program.
+ *  It is a user initialization task and has the responsibility for creating
+ *  and starting the tasks that make up the test.  If the time of day
+ *  clock is required for the test, it should also be set to a known
+ *  value by this function.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#define TEST_INIT
+#include "system.h"
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_time_of_day  time;
+  rtems_status_code  status;
+
+  puts( "\n\n*** TEST 31 ***" );
+
+  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+
+  status = rtems_clock_set( &time );
+  directive_failed( status, "rtems_clock_set" );
+
+  status = rtems_timer_initiate_server(
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_ATTRIBUTES
+  );
+  directive_failed( status, "rtems_timer_initiate_server" );
+
+  Task_name[ 1 ]  = rtems_build_name( 'T', 'A', '1', ' ' );
+  Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
+
+  status = rtems_task_create(
+    Task_name[ 1 ],
+    1,
+    RTEMS_MINIMUM_STACK_SIZE * 2,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &Task_id[ 1 ]
+  );
+  directive_failed( status, "rtems_task_create of TA1" );
+
+  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
+  directive_failed( status, "rtems_task_start of TA1" );
+
+  puts( "INIT - rtems_timer_create - creating timer 1" );
+  status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
+  directive_failed( status, "rtems_timer_create" );
+
+  printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
Index: testsuites/sptests/sp31/prtime.c
===================================================================
--- testsuites/sptests/sp31/prtime.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/prtime.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,31 @@
+/*  Print_time
+ *
+ *  This routine prints the name of Task_1 and the current time of day.
+ *
+ *  Input parameters:  NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+void Print_time( void )
+{
+  rtems_time_of_day time;
+  rtems_status_code status;
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_get" );
+
+  put_name( Task_name[ 1 ], FALSE );
+  print_time( "- rtems_clock_get - ", &time, "\n" );
+}
Index: testsuites/sptests/sp31/sp31.scn
===================================================================
--- testsuites/sptests/sp31/sp31.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/sp31.scn	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,29 @@
+*** TEST 31 ***
+INIT - rtems_timer_create - creating timer 1
+INIT - timer 1 has id (0x14010001)
+TA1 - rtems_timer_ident - identing timer 1
+TA1 - timer 1 has id (0x14010001)
+TA1 - rtems_clock_get - 09:00:00   12/31/1988
+TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:03   12/31/1988
+TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:04   12/31/1988
+TA1 - rtems_timer_reset - timer 1
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:07   12/31/1988
+<pause>
+TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_clock_get - 09:00:07   12/31/1988
+TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_suspend( RTEMS_SELF )
+TA1 - rtems_clock_get - 09:00:10   12/31/1988
+TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_clock_get - 09:00:11   12/31/1988
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_task_wake_after - YIELD (only task at priority)
+TA1 - timer_deleting - timer 1
+*** END OF TEST 31 ***
Index: testsuites/sptests/sp31/system.h
===================================================================
--- testsuites/sptests/sp31/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/system.h	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,58 @@
+/*  system.h
+ *
+ *  This include file contains information that is included in every
+ *  function in the test set.
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+ 
+rtems_timer_service_routine Delayed_resume(
+  rtems_id  ignored_id,
+  void     *ignored_address
+);
+ 
+void Print_time( void );
+ 
+rtems_task Task_1(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS           3
+#define CONFIGURE_MAXIMUM_TIMERS          2
+#define CONFIGURE_INIT_TASK_STACK_SIZE    (RTEMS_MINIMUM_STACK_SIZE * 2)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS       (1 * RTEMS_MINIMUM_STACK_SIZE)
+
+#include <confdefs.h>
+
+/* global variables */
+
+TEST_EXTERN rtems_id   Task_id[ 4 ];         /* array of task ids */
+TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
+
+TEST_EXTERN rtems_id   Timer_id[ 2 ];    /* array of timer ids */
+TEST_EXTERN rtems_name Timer_name[ 2 ];  /* array of timer names */
+
+/* end of include file */
Index: testsuites/sptests/sp31/task1.c
===================================================================
--- testsuites/sptests/sp31/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
+++ testsuites/sptests/sp31/task1.c	(revision de569fee9ff6ded0a71bd76d3cdefb82b5399419)
@@ -0,0 +1,163 @@
+/*  Task_1
+ *
+ *  This routine serves as a test task.  It verifies the basic task
+ *  switching capabilities of the executive.
+ *
+ *  Input parameters:
+ *    argument - task argument
+ *
+ *  Output parameters:  NONE
+ *
+ *  COPYRIGHT (c) 1989-2002.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include "system.h"
+
+rtems_task Task_1(
+  rtems_task_argument argument
+)
+{
+  rtems_id          tmid;
+  rtems_time_of_day time;
+  rtems_status_code status;
+
+/* Get id */
+
+  puts( "TA1 - rtems_timer_ident - identing timer 1" );
+  status = rtems_timer_ident( Timer_name[ 1 ], &tmid );
+  directive_failed( status, "rtems_timer_ident" );
+  printf( "TA1 - timer 1 has id (0x%x)\n", tmid );
+
+/* after which is allowed to fire */
+
+  Print_time();
+
+  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_after(
+    tmid,
+    3 * TICKS_PER_SECOND,
+    Delayed_resume,
+    NULL
+  );
+  directive_failed( status, "rtems_timer_server_fire_after" );
+
+  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
+
+  Print_time();
+
+/* after which is reset and allowed to fire */
+
+  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_after(
+    tmid,
+    3 * TICKS_PER_SECOND,
+    Delayed_resume,
+    NULL
+  );
+  directive_failed( status, "rtems_timer_server_fire_after" );
+
+  puts( "TA1 - rtems_task_wake_after - 1 second" );
+  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+  directive_failed( status, "rtems_task_wake_after" );
+
+  Print_time();
+
+  puts( "TA1 - rtems_timer_reset - timer 1" );
+  status = rtems_timer_reset( tmid );
+  directive_failed( status, "rtems_timer_reset" );
+
+  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
+
+  Print_time();
+
+  rtems_test_pause();
+
+  /*
+   *  Reset the time since we do not know how long the user waited
+   *  before pressing <cr> at the pause.  This insures that the 
+   *  actual output matches the screen.
+   */
+
+  build_time( &time, 12, 31, 1988, 9, 0, 7, 0 );
+
+  status = rtems_clock_set( &time );
+  directive_failed( status, "rtems_clock_set" );
+
+/* after which is canceled */
+
+  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_after(
+    tmid,
+    3 * TICKS_PER_SECOND,
+    Delayed_resume,
+    NULL
+  );
+  directive_failed( status, "rtems_timer_server_fire_after" );
+
+  puts( "TA1 - rtems_timer_cancel - timer 1" );
+  status = rtems_timer_cancel( tmid );
+  directive_failed( status, "rtems_timer_cancel" );
+
+/* when which is allowed to fire */
+
+  Print_time();
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_get" );
+
+  time.second += 3;
+
+  puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_when( tmid, &time, Delayed_resume, NULL );
+  directive_failed( status, "rtems_timer_server_fire_when" );
+
+  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
+  status = rtems_task_suspend( RTEMS_SELF );
+  directive_failed( status, "rtems_task_suspend" );
+
+  Print_time();
+
+/* when which is canceled */
+
+  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+  directive_failed( status, "rtems_clock_get" );
+
+  time.second += 3;
+
+  puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" );
+  status = rtems_timer_server_fire_when( tmid, &time, Delayed_resume, NULL );
+  directive_failed( status, "rtems_timer_server_fire_when" );
+
+  puts( "TA1 - rtems_task_wake_after - 1 second" );
+  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
+  directive_failed( status, "rtems_task_wake_after" );
+
+  Print_time();
+
+  puts( "TA1 - rtems_timer_cancel - timer 1" );
+  status = rtems_timer_cancel( tmid );
+  directive_failed( status, "rtems_timer_cancel" );
+
+/* delete */
+  puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" );
+  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
+  directive_failed( status, "rtems_task_wake_after" );
+
+  puts( "TA1 - timer_deleting - timer 1" );
+  status = rtems_timer_delete( tmid );
+  directive_failed( status, "rtems_timer_delete" );
+
+  puts( "*** END OF TEST 31 *** " );
+  exit( 0 );
+}
