Index: cpukit/libmisc/capture/capture-cli.c
===================================================================
--- cpukit/libmisc/capture/capture-cli.c	(revision f466e567a1f2d24df9642c1859c9788836de31ab)
+++ cpukit/libmisc/capture/capture-cli.c	(revision db8a89e21254b0756a053709e56e5119fa75c2f1)
@@ -37,4 +37,6 @@
 #include <rtems/monitor.h>
 
+#define RC_UNUSED __attribute__((unused))
+
 #define RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS (20)
 
@@ -62,8 +64,8 @@
 
 static void
-rtems_capture_cli_open (int                          argc,
-                        char**                       argv,
-                        const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                        bool                         verbose __attribute__((unused)))
+rtems_capture_cli_open (int                                argc,
+                        char**                             argv,
+                        const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                        bool                               verbose RC_UNUSED)
 {
   uint32_t          size = 0;
@@ -133,8 +135,8 @@
 
 static void
-rtems_capture_cli_close (int                          argc __attribute__((unused)),
-                         char**                       argv __attribute__((unused)),
-                         const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                         bool                         verbose __attribute__((unused)))
+rtems_capture_cli_close (int                                argc RC_UNUSED,
+                         char**                             argv RC_UNUSED,
+                         const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                         bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -161,8 +163,8 @@
 
 static void
-rtems_capture_cli_enable (int                          argc __attribute__((unused)),
-                          char**                       argv __attribute__((unused)),
-                          const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                          bool                         verbose __attribute__((unused)))
+rtems_capture_cli_enable (int                                argc RC_UNUSED,
+                          char**                             argv RC_UNUSED,
+                          const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                          bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -189,8 +191,8 @@
 
 static void
-rtems_capture_cli_disable (int                          argc __attribute__((unused)),
-                           char**                       argv __attribute__((unused)),
-                           const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                           bool                         verbose __attribute__((unused)))
+rtems_capture_cli_disable (int                                argc RC_UNUSED,
+                           char**                             argv RC_UNUSED,
+                           const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                           bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -217,26 +219,18 @@
 
 static void
-rtems_capture_cli_task_list (int                          argc __attribute__((unused)),
-                             char**                       argv __attribute__((unused)),
-                             const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                             bool                         verbose __attribute__((unused)))
+rtems_capture_cli_task_list (int                                argc RC_UNUSED,
+                             char**                             argv RC_UNUSED,
+                             const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                             bool                               verbose RC_UNUSED)
 {
   rtems_task_priority   ceiling = rtems_capture_watch_get_ceiling ();
   rtems_task_priority   floor = rtems_capture_watch_get_floor ();
   rtems_capture_task_t* task = rtems_capture_get_task_list ();
-  uint32_t              ticks;
-  uint32_t              tick_offset;
-  unsigned long long    total_time;
+  rtems_capture_time_t  total_time;
   int                   count = rtems_capture_task_count ();
 
-  if (capture_timestamp)
-    capture_timestamp (&ticks, &tick_offset);
-  else
-  {
-    ticks = rtems_clock_get_ticks_since_boot();
-    tick_offset = 0;
-  }
-
-  fprintf (stdout, "total %i\n", count);
+  rtems_capture_time (&total_time);
+
+  fprintf (stdout, "total %i time:%Lu\n", count, (uint64_t) total_time);
 
   while (task)
@@ -245,13 +239,12 @@
     int32_t             stack_used;
     int32_t             time_used;
+    int                 length;
 
     stack_used = rtems_capture_task_stack_usage (task);
     if (stack_used)
-      stack_used = (stack_used * 100) / stack_used;
+      stack_used = (stack_used * 100) / rtems_capture_task_stack_size (task);
 
     if (stack_used > 100)
       stack_used = 100;
-
-    total_time = (ticks * rtems_capture_task_time (task)) + tick_offset;
 
     time_used = (rtems_capture_task_time (task) * 100) / total_time;
@@ -265,5 +258,5 @@
     rtems_monitor_dump_id (rtems_capture_task_id (task));
     fprintf (stdout, " ");
-    rtems_monitor_dump_name (rtems_capture_task_name (task));
+    rtems_monitor_dump_name (rtems_capture_task_id (task));
     fprintf (stdout, " ");
     rtems_monitor_dump_priority (rtems_capture_task_start_priority (task));
@@ -273,5 +266,6 @@
     rtems_monitor_dump_priority (rtems_capture_task_curr_priority (task));
     fprintf (stdout, " ");
-    rtems_monitor_dump_state (rtems_capture_task_state (task));
+    length = rtems_monitor_dump_state (rtems_capture_task_state (task));
+    fprintf (stdout, "%*c", 14 - length, ' ');
     fprintf (stdout, " %c%c",
              rtems_capture_task_valid (task) ? 'a' : 'd',
@@ -288,6 +282,6 @@
                rtems_capture_watch_global_on () ? 'g' : '-');
     }
-    fprintf (stdout, " %3" PRId32 "%% %3" PRId32 "%% (%" PRIu32 ")\n",
-            stack_used, time_used, rtems_capture_task_ticks (task));
+    fprintf (stdout, " %3" PRId32 "%% %3" PRId32 "%% (%" PRIu64 ")\n",
+            stack_used, time_used, rtems_capture_task_time (task));
 
     task = rtems_capture_next_task (task);
@@ -305,5 +299,5 @@
 
 static void
-rtems_capture_cli_task_load_thread (rtems_task_argument arg __attribute__((unused)))
+rtems_capture_cli_task_load_thread (rtems_task_argument arg RC_UNUSED)
 {
   rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
@@ -316,5 +310,5 @@
     unsigned long long    load[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
     rtems_capture_task_t* task;
-    unsigned long long    total_time;
+    rtems_capture_time_t  total_time;
     int                   count = 0;
     int                   i;
@@ -340,5 +334,5 @@
       if (rtems_capture_task_valid (task))
       {
-        unsigned long long l = rtems_capture_task_delta_time (task);
+        rtems_capture_time_t l = rtems_capture_task_delta_time (task);
 
         count++;
@@ -370,5 +364,5 @@
     fprintf (stdout, "\x1b[H\x1b[J Press ENTER to exit.\n\n");
     fprintf (stdout,
-             "     PID NAME RPRI CPRI STATE  %%CPU     %%STK FLGS    EXEC TIME\n");
+             "     PID NAME RPRI CPRI STATE          %%CPU     %%STK FLGS    EXEC TIME\n");
 
     if (count > last_count)
@@ -391,5 +385,5 @@
       stack_used = rtems_capture_task_stack_usage (tasks[i]);
       if (stack_used)
-        stack_used = (stack_used * 100) / stack_used;
+        stack_used = (stack_used * 100) / rtems_capture_task_stack_size (tasks[i]);
 
       if (stack_used > 100)
@@ -403,5 +397,5 @@
       rtems_monitor_dump_id (rtems_capture_task_id (tasks[i]));
       fprintf (stdout, " ");
-      rtems_monitor_dump_name (rtems_capture_task_name (tasks[i]));
+      rtems_monitor_dump_name (rtems_capture_task_id (tasks[i]));
       fprintf (stdout, "  ");
       rtems_monitor_dump_priority (priority);
@@ -410,5 +404,5 @@
       fprintf (stdout, " ");
       k = rtems_monitor_dump_state (rtems_capture_task_state (tasks[i]));
-      fprintf (stdout, "%*c %3i.%03i%% ", 6 - k, ' ',
+      fprintf (stdout, "%*c %3i.%03i%% ", 14 - k, ' ',
                task_load / 1000, task_load % 1000);
       fprintf (stdout, "%3i%% %c%c", stack_used,
@@ -425,5 +419,6 @@
                 rtems_capture_watch_global_on () ? 'g' : '-');
 
-      fprintf (stdout, "   %qi\n", rtems_capture_task_time (tasks[i]));
+      fprintf (stdout, "   %qi\n",
+               rtems_capture_task_time (tasks[i]));
     }
 
@@ -456,8 +451,8 @@
 
 static void
-rtems_capture_cli_task_load (int                          argc __attribute__((unused)),
-                             char**                       argv __attribute__((unused)),
-                             const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                             bool                         verbose __attribute__((unused)))
+rtems_capture_cli_task_load (int                                argc RC_UNUSED,
+                             char**                             argv RC_UNUSED,
+                             const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                             bool                               verbose RC_UNUSED)
 {
   rtems_status_code   sc;
@@ -529,8 +524,8 @@
 
 static void
-rtems_capture_cli_watch_list (int                          argc __attribute__((unused)),
-                              char**                       argv __attribute__((unused)),
-                              const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                              bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_list (int                                argc RC_UNUSED,
+                              char**                             argv RC_UNUSED,
+                              const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                              bool                               verbose RC_UNUSED)
 {
   rtems_capture_control_t* control = rtems_capture_get_control_list ();
@@ -619,9 +614,9 @@
 
 static bool
-rtems_capture_cli_get_name_id (char*          arg,
-                               bool*          valid_name,
-                               bool*          valid_id,
-                               rtems_name*    name,
-                               rtems_id*      id)
+rtems_capture_cli_get_name_id (char*       arg,
+                               bool*       valid_name,
+                               bool*       valid_id,
+                               rtems_name* name,
+                               rtems_id*   id)
 {
   size_t l;
@@ -681,8 +676,8 @@
 
 static void
-rtems_capture_cli_watch_add (int                          argc,
-                             char**                       argv,
-                             const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                             bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_add (int                                argc,
+                             char**                             argv,
+                             const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                             bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -744,8 +739,8 @@
 
 static void
-rtems_capture_cli_watch_del (int                          argc,
-                             char**                       argv,
-                             const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                             bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_del (int                                argc,
+                             char**                             argv,
+                             const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                             bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -806,8 +801,8 @@
 
 static void
-rtems_capture_cli_watch_control (int                          argc,
-                                 char**                       argv,
-                                 const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                                 bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_control (int                                argc,
+                                 char**                             argv,
+                                 const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                                 bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -873,8 +868,8 @@
 
 static void
-rtems_capture_cli_watch_global (int                          argc,
-                                char**                       argv,
-                                const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                                bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_global (int                                argc,
+                                char**                             argv,
+                                const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                                bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
@@ -927,8 +922,8 @@
 
 static void
-rtems_capture_cli_watch_ceiling (int                          argc,
-                                 char**                       argv,
-                                 const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                                 bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_ceiling (int                                argc,
+                                 char**                             argv,
+                                 const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                                 bool                               verbose RC_UNUSED)
 {
   rtems_status_code   sc;
@@ -978,8 +973,8 @@
 
 static void
-rtems_capture_cli_watch_floor (int                          argc,
-                               char**                       argv,
-                               const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                               bool                         verbose __attribute__((unused)))
+rtems_capture_cli_watch_floor (int                                argc,
+                               char**                             argv,
+                               const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                               bool                               verbose RC_UNUSED)
 {
   rtems_status_code   sc;
@@ -1083,4 +1078,5 @@
   bool                         trigger_set = false;
   bool                         is_from = false;
+  bool                         is_to = false;
   rtems_name                   name = 0;
   rtems_id                     id = 0;
@@ -1138,8 +1134,17 @@
       if (strcmp (arg[argv], "from") == 0)
       {
-        if (is_from)
+        if (from_valid_name || from_valid_id)
           fprintf (stdout, "warning: extra 'from' ignored\n");
 
-        is_from = 1;
+        is_from = true;
+        continue;
+      }
+
+      if (strcmp (arg[argv], "to") == 0)
+      {
+        if (to_valid_name || from_valid_id)
+          fprintf (stdout, "warning: extra 'to' ignored\n");
+
+        is_to = true;
         continue;
       }
@@ -1151,4 +1156,7 @@
       if (valid_name)
       {
+        if (!is_from && !is_to)
+          is_to = true;
+
         if (is_from)
         {
@@ -1159,5 +1167,5 @@
           }
           else
-            fprintf (stdout, "warning: extra arguments ignored\n");
+            fprintf (stdout, "warning: extra name arguments ignored\n");
         }
         else if (!to_valid_name && !to_valid_id)
@@ -1167,9 +1175,12 @@
         }
         else
-          fprintf (stdout, "warning: extra arguments ignored\n");
+          fprintf (stdout, "warning: extra name arguments ignored\n");
       }
 
       if (valid_id)
       {
+        if (!is_from && !is_to)
+          is_to = true;
+
         if (is_from)
         {
@@ -1180,5 +1191,5 @@
           }
           else
-            fprintf (stdout, "warning: extra arguments ignored\n");
+            fprintf (stdout, "warning: extra id arguments ignored\n");
         }
         else if (!to_valid_name && !to_valid_id)
@@ -1188,5 +1199,5 @@
         }
         else
-          fprintf (stdout, "warning: extra arguments ignored\n");
+          fprintf (stdout, "warning: extra id arguments ignored\n");
       }
     }
@@ -1202,5 +1213,5 @@
   if (!to_valid_name && !to_valid_id && !from_valid_name && !from_valid_id)
   {
-    fprintf (stdout, trigger_set_usage);
+    fprintf (stdout, trigger_set_usage, set ? "ctset" : "ctclear");
     return;
   }
@@ -1256,8 +1267,8 @@
 
 static void
-rtems_capture_cli_trigger_set (int                          argc,
-                               char**                       argv,
-                               const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                               bool                         verbose __attribute__((unused)))
+rtems_capture_cli_trigger_set (int                                argc,
+                               char**                             argv,
+                               const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                               bool                               verbose RC_UNUSED)
 {
   rtems_capture_cli_trigger_worker (1, argc, argv);
@@ -1274,8 +1285,8 @@
 
 static void
-rtems_capture_cli_trigger_clear (int                          argc,
-                                 char**                       argv,
-                                 const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                                 bool                         verbose __attribute__((unused)))
+rtems_capture_cli_trigger_clear (int                                argc,
+                                 char**                             argv,
+                                 const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                                 bool                               verbose RC_UNUSED)
 {
   rtems_capture_cli_trigger_worker (0, argc, argv);
@@ -1292,8 +1303,8 @@
 
 static void
-rtems_capture_cli_trace_records (int                          argc,
-                                 char**                       argv,
-                                 const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                                 bool                         verbose __attribute__((unused)))
+rtems_capture_cli_trace_records (int                                argc,
+                                 char**                             argv,
+                                 const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                                 bool                               verbose RC_UNUSED)
 {
   rtems_status_code       sc;
@@ -1363,21 +1374,19 @@
       if (csv)
         fprintf (stdout, "%08" PRIxPTR ",%03" PRIu32
-                   ",%03" PRIu32 ",%04" PRIx32 ",%" PRId32 ",%" PRId32 "\n",
-                (uintptr_t) rec->task,
-                (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
-                (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
-                (rec->events >> RTEMS_CAPTURE_EVENT_START),
-                rec->ticks, rec->tick_offset);
+                   ",%03" PRIu32 ",%04" PRIx32 ",%" PRId64 "\n",
+                 (uintptr_t) rec->task,
+                 (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
+                 (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
+                 (rec->events >> RTEMS_CAPTURE_EVENT_START),
+                 (uint64_t) rec->time);
       else
       {
-        unsigned long long t;
-        uint32_t     event;
-        int                e;
+        rtems_capture_time_t t;
+        uint32_t             event;
+        int                  e;
 
         event = rec->events >> RTEMS_CAPTURE_EVENT_START;
 
-        t  = rec->ticks;
-        t *= rtems_capture_tick_time ();
-        t += rec->tick_offset;
+        t = rec->time;
 
         for (e = RTEMS_CAPTURE_EVENT_START; e < RTEMS_CAPTURE_EVENT_END; e++)
@@ -1385,9 +1394,13 @@
           if (event & 1)
           {
-            fprintf (stdout, "%9li.%06li ", (unsigned long) (t / 1000000),
-                    (unsigned long) (t % 1000000));
+            fprintf (stdout, "%9li.%06li ",
+                     (unsigned long) (t / 1000000000ULL),
+                     (unsigned long) (t % 1000000000ULL));
             rtems_monitor_dump_id (rtems_capture_task_id (rec->task));
-            fprintf (stdout, " ");
-            rtems_monitor_dump_name (rtems_capture_task_name (rec->task));
+            fprintf (stdout, " %c%c%c%c",
+                     (char) (rec->task->name >> 24) & 0xff,
+                     (char) (rec->task->name >> 16) & 0xff,
+                     (char) (rec->task->name >> 8) & 0xff,
+                     (char) (rec->task->name >> 0) & 0xff);
             fprintf (stdout, " %3" PRId32 " %3" PRId32 " %s\n",
                     (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
@@ -1423,8 +1436,8 @@
 
 static void
-rtems_capture_cli_flush (int                          argc,
-                         char**                       argv,
-                         const rtems_monitor_command_arg_t* command_arg __attribute__((unused)),
-                         bool                         verbose __attribute__((unused)))
+rtems_capture_cli_flush (int                                argc,
+                         char**                             argv,
+                         const rtems_monitor_command_arg_t* command_arg RC_UNUSED,
+                         bool                               verbose RC_UNUSED)
 {
   rtems_status_code sc;
Index: cpukit/libmisc/capture/capture.c
===================================================================
--- cpukit/libmisc/capture/capture.c	(revision f466e567a1f2d24df9642c1859c9788836de31ab)
+++ cpukit/libmisc/capture/capture.c	(revision db8a89e21254b0756a053709e56e5119fa75c2f1)
@@ -30,5 +30,7 @@
 
 #include "capture.h"
+
 #include <rtems/score/statesimpl.h>
+#include <rtems/score/todimpl.h>
 
 /*
@@ -82,5 +84,4 @@
 static rtems_task_priority      capture_ceiling;
 static rtems_task_priority      capture_floor;
-static uint32_t                 capture_tick_period;
 static rtems_id                 capture_reader;
 
@@ -113,13 +114,12 @@
  * by the user get the time from that.
  */
-static inline void rtems_capture_get_time (uint32_t* ticks,
-                                           uint32_t* tick_offset)
+static inline void
+rtems_capture_get_time (rtems_capture_time_t* time)
 {
   if (capture_timestamp)
-    capture_timestamp (ticks, tick_offset);
+    capture_timestamp (time);
   else
   {
-    *ticks       = rtems_clock_get_ticks_since_boot();
-    *tick_offset = 0;
+    _TOD_Get_uptime(time);
   }
 }
@@ -397,4 +397,5 @@
   rtems_capture_control_t* control;
   rtems_name               name;
+  rtems_capture_time_t     time;
   bool                     ok;
 
@@ -406,4 +407,9 @@
     return NULL;
   }
+
+  /*
+   * Get the current time.
+   */
+  rtems_capture_get_time (&time);
 
   /*
@@ -421,11 +427,8 @@
   task->out              = 0;
   task->tcb              = new_task;
-  task->ticks            = 0;
-  task->tick_offset      = 0;
-  task->ticks_in         = 0;
-  task->tick_offset_in   = 0;
+  task->time             = 0;
+  task->time_in          = time;
   task->control          = 0;
-  task->last_ticks       = 0;
-  task->last_tick_offset = 0;
+  task->last_time        = 0;
 
   task->tcb->extensions[capture_extension_index] = task;
@@ -548,5 +551,5 @@
           task->flags |= RTEMS_CAPTURE_TRACED;
 
-        rtems_capture_get_time (&capture_in->ticks, &capture_in->tick_offset);
+        rtems_capture_get_time (&capture_in->time);
 
         if (capture_in == &capture_records[capture_size - 1])
@@ -894,6 +897,5 @@
   if (capture_flags & RTEMS_CAPTURE_ON)
   {
-    uint32_t ticks;
-    uint32_t tick_offset;
+    rtems_capture_time_t time;
 
     /*
@@ -930,8 +932,8 @@
 
     /*
-     * Update the execution time. Assume the tick will not overflow
+     * Update the execution time. Assume the time will not overflow
      * for now. This may need to change.
      */
-    rtems_capture_get_time (&ticks, &tick_offset);
+    rtems_capture_get_time (&time);
 
     /*
@@ -943,6 +945,5 @@
     {
       ht->in++;
-      ht->ticks_in       = ticks;
-      ht->tick_offset_in = tick_offset;
+      ht->time_in = time;
     }
 
@@ -950,22 +951,5 @@
     {
       ct->out++;
-      ct->ticks += ticks - ct->ticks_in;
-
-      if (capture_timestamp)
-      {
-        tick_offset += capture_tick_period - ct->tick_offset_in;
-
-        if (tick_offset < capture_tick_period)
-          ct->tick_offset = tick_offset;
-        else
-        {
-          ct->ticks++;
-          ct->tick_offset = tick_offset - capture_tick_period;
-        }
-      }
-      else
-      {
-        ct->tick_offset += 100;
-      }
+      ct->time += time - ct->time_in;
     }
 
@@ -1029,9 +1013,4 @@
 
   /*
-   * Get the tick period from the BSP Configuration Table.
-   */
-  capture_tick_period = rtems_configuration_get_microseconds_per_tick();
-
-  /*
    * Register the user extension handlers for the CAPture Engine.
    */
@@ -1071,5 +1050,4 @@
   rtems_capture_task_t*    task;
   rtems_capture_control_t* control;
-  rtems_capture_record_t*  records;
   rtems_status_code        sc;
 
@@ -1084,5 +1062,4 @@
   capture_flags &= ~(RTEMS_CAPTURE_ON | RTEMS_CAPTURE_ONLY_MONITOR);
 
-  records = capture_records;
   capture_records = NULL;
 
@@ -1137,4 +1114,10 @@
  * This function allows control of tracing at a global level.
  */
+static void
+rtems_capture_task_setup (Thread_Control *tcb)
+{
+  rtems_capture_create_capture_task (tcb);
+}
+
 rtems_status_code
 rtems_capture_control (bool enable)
@@ -1154,4 +1137,6 @@
   else
     capture_flags &= ~RTEMS_CAPTURE_ON;
+
+  rtems_iterate_over_all_threads (rtems_capture_task_setup);
 
   rtems_interrupt_enable (level);
@@ -1842,14 +1827,15 @@
 
 /*
- * rtems_capture_tick_time
- *
- *  DESCRIPTION:
- *
- * This function returns the tick period in nano-seconds.
- */
-uint32_t
-rtems_capture_tick_time (void)
-{
-  return capture_tick_period;
+ * rtems_capture_time
+ *
+ *  DESCRIPTION:
+ *
+ * This function returns the current time. If a handler is provided
+ * by the user get the time from that.
+ */
+void
+rtems_capture_time (rtems_capture_time_t* uptime)
+{
+  rtems_capture_get_time(uptime);
 }
 
Index: cpukit/libmisc/capture/capture.h
===================================================================
--- cpukit/libmisc/capture/capture.h	(revision f466e567a1f2d24df9642c1859c9788836de31ab)
+++ cpukit/libmisc/capture/capture.h	(revision db8a89e21254b0756a053709e56e5119fa75c2f1)
@@ -44,4 +44,13 @@
  */
 #define RTEMS_CAPTURE_TRIGGER_TASKS (32)
+
+/**
+ * rtems_capture_time_t
+ *
+ * DESCRIPTION:
+ *
+ * A capture timestamp.
+ */
+typedef Timestamp_Control rtems_capture_time_t;
 
 /**
@@ -157,10 +166,7 @@
   uint32_t                     stack_size;
   uint32_t                     stack_clean;
-  uint32_t                     ticks;
-  uint32_t                     tick_offset;
-  uint32_t                     ticks_in;
-  uint32_t                     tick_offset_in;
-  uint32_t                     last_ticks;
-  uint32_t                     last_tick_offset;
+  rtems_capture_time_t         time;
+  rtems_capture_time_t         time_in;
+  rtems_capture_time_t         last_time;
   rtems_capture_control_t*     control;
   struct rtems_capture_task_s* forw;
@@ -186,6 +192,5 @@
   rtems_capture_task_t* task;
   uint32_t              events;
-  uint32_t              ticks;
-  uint32_t              tick_offset;
+  rtems_capture_time_t  time;
 } rtems_capture_record_t;
 
@@ -255,6 +260,5 @@
  */
 
-typedef void (*rtems_capture_timestamp)
-                (uint32_t* ticks, uint32_t* micro);
+typedef void (*rtems_capture_timestamp)(rtems_capture_time_t* time);
 
 /**
@@ -510,23 +514,13 @@
 rtems_capture_release (uint32_t count);
 
-/**
- * rtems_capture_tick_time
- *
- *  DESCRIPTION:
- *
- * This function returns the tick period in micro-seconds.
- */
-uint32_t
-rtems_capture_tick_time (void);
-
 /*
- * rtems_capture_tick_time
- *
- *  DESCRIPTION:
- *
- * This function returns the tick period in micro-seconds.
- */
-uint32_t
-rtems_capture_tick_time (void);
+ * rtems_capture_time
+ *
+ *  DESCRIPTION:
+ *
+ * This function returns the time period in nano-seconds.
+ */
+void
+rtems_capture_time (rtems_capture_time_t* uptime);
 
 /**
@@ -773,30 +767,4 @@
 
 /**
- * rtems_capture_task_ticks
- *
- *  DESCRIPTION:
- *
- * This function returns the current execution time as ticks.
- */
-static inline uint32_t
-rtems_capture_task_ticks (rtems_capture_task_t* task)
-{
-  return task->ticks;
-}
-
-/**
- * rtems_capture_task_tick_offset
- *
- *  DESCRIPTION:
- *
- * This function returns the current execution time tick offset.
- */
-static inline uint32_t
-rtems_capture_task_tick_offset (rtems_capture_task_t* task)
-{
-  return task->tick_offset;
-}
-
-/**
  * rtems_capture_task_time
  *
@@ -805,9 +773,8 @@
  * This function returns the current execution time.
  */
-static inline unsigned long long
+static inline uint64_t
 rtems_capture_task_time (rtems_capture_task_t* task)
 {
-  unsigned long long t = task->ticks;
-  return (t * rtems_capture_tick_time ()) + task->tick_offset;;
+  return task->time;
 }
 
@@ -820,14 +787,10 @@
  * last time the detla time was and now.
  */
-static inline unsigned long long
+static inline uint64_t
 rtems_capture_task_delta_time (rtems_capture_task_t* task)
 {
-  unsigned long long t = task->ticks - task->last_ticks;
-  uint32_t     o = task->tick_offset - task->last_tick_offset;
-
-  task->last_ticks       = task->ticks;
-  task->last_tick_offset = task->tick_offset;
-
-  return (t * rtems_capture_tick_time ()) + o;
+  uint64_t t = task->time - task->last_time;
+  task->last_time = task->time;
+  return t;
 }
 
@@ -844,5 +807,5 @@
 {
   rtems_capture_task_t* task = rtems_capture_get_task_list ();
-  uint32_t        count = 0;
+  uint32_t              count = 0;
 
   while (task)
