home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gnat-2.06-src.tgz / tar.out / fsf / gnat / ada / s-tasclo.ads < prev    next >
Text File  |  1996-09-28  |  4KB  |  94 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --                     S Y S T E M . T A S K _ C L O C K                    --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.11 $                             --
  10. --                                                                          --
  11. --     Copyright (c) 1991,1992,1993,1994,1995 FSU, All Rights Reserved      --
  12. --                                                                          --
  13. -- GNARL is free software; you can redistribute it  and/or modify it  under --
  14. -- terms  of  the  GNU  Library General Public License  as published by the --
  15. -- Free Software  Foundation;  either version 2, or (at  your  option)  any --
  16. -- later  version.  GNARL is distributed  in the hope that  it will be use- --
  17. -- ful, but but WITHOUT ANY WARRANTY;  without even the implied warranty of --
  18. -- MERCHANTABILITY  or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. -- eral Library Public License  for more details.  You should have received --
  20. -- a  copy of the GNU Library General Public License along with GNARL;  see --
  21. -- file COPYING.LIB.  If not,  write to the  Free Software Foundation,  675 --
  22. -- Mass Ave, Cambridge, MA 02139, USA.                                      --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  This package interfaces with the Ada RTS and defines the low-level
  27. --  timer operations.
  28.  
  29. with Interfaces;
  30.  
  31. package System.Task_Clock is
  32.  
  33.    type Stimespec is private;
  34.  
  35.    Stimespec_First : constant Stimespec;
  36.  
  37.    Stimespec_Last  : constant Stimespec;
  38.  
  39.    Stimespec_Zero  : constant Stimespec;
  40.  
  41.    Stimespec_Unit  : constant Stimespec;
  42.  
  43.    Stimespec_Sec_Unit : constant Stimespec;
  44.  
  45.    function Stimespec_Seconds (TV : Stimespec) return Integer;
  46.  
  47.    function Stimespec_NSeconds (TV : Stimespec) return Integer;
  48.  
  49.    function Time_Of (S, NS : Integer) return Stimespec;
  50.  
  51.    function Stimespec_To_Duration (TV : Stimespec) return Duration;
  52.  
  53.    function Duration_To_Stimespec (Time : Duration) return Stimespec;
  54.  
  55.    function "-"  (TV : Stimespec) return Stimespec;
  56.  
  57.    function "+"  (LTV, RTV : Stimespec) return Stimespec;
  58.  
  59.    function "-"  (LTV, RTV : Stimespec) return Stimespec;
  60.  
  61.    function "*" (TV : Stimespec; N : Integer) return Stimespec;
  62.  
  63.    function "/" (TV : Stimespec; N : integer) return Stimespec;
  64.  
  65.    function "/" (LTV, RTV : Stimespec) return Integer;
  66.  
  67.    function "<"  (LTV, RTV : Stimespec) return Boolean;
  68.  
  69.    function "<=" (LTV, RTV : Stimespec) return Boolean;
  70.  
  71.    function ">"  (LTV, RTV : Stimespec) return Boolean;
  72.  
  73.    function ">=" (LTV, RTV : Stimespec) return Boolean;
  74.  
  75. private
  76.  
  77.    --  Stimespec is represented in 64-bit Integer. It represents time in
  78.    --  nanoseconds. For example, 1 second and 1 nanosecond is represented
  79.    --  as "1_000_000_001"
  80.  
  81.    type Stimespec is new Interfaces.Integer_64;
  82.  
  83.    Stimespec_First    : constant Stimespec := Stimespec'First;
  84.  
  85.    Stimespec_Last     : constant Stimespec := Stimespec'Last;
  86.  
  87.    Stimespec_Zero     : constant Stimespec := 0;
  88.  
  89.    Stimespec_Unit     : constant Stimespec := 1;
  90.  
  91.    Stimespec_Sec_Unit : constant Stimespec := 10#1#E9;
  92.  
  93. end System.Task_Clock;
  94.