comp.lang.ada
 help / color / mirror / Atom feed
* Help,  Gnat Ada95 REAL_TIME ANNEX problemS
@ 1997-07-24  0:00 JD
       [not found] ` <199707251330.PAA20083@basement.replay.com>
  0 siblings, 1 reply; 2+ messages in thread
From: JD @ 1997-07-24  0:00 UTC (permalink / raw)



Hello Ada people,


   I have been using Ada83 and recently switched to Gnat 3.09 Ada95. 
Part of the code I am writing utilizes timers. The Ada83 version of 
the timer code had used the CALENDAR package, I am trying to change 
this timer code to take advantage of the finer granularity found in 
the Ada95 REAL_TIME package. I have read that `Calendar.Clock' and
`Real_Time.Clock' are implemented as transformations of the same 
time base. However I can't seem to get the REAL_TIME package to work
with the "+", and "-" functions. The error from the compilier
is:

gnatmake -I../common1 temp_controller
gcc -c -I./ -I../common1 -I- ../common1/run_time_timer1.adb
run_time_timer1.adb:97:49: invalid operand types for operator "+"
run_time_timer1.adb:97:63: expected type "Standard.DURATION"
run_time_timer1.adb:97:63: found private type "Ada.Real_Time.Time"
gnatmake: "../common1/run_time_timer1.adb" compilation error
*** Error code 2
make: Fatal error: Command failed for target `all'


The rom the a-calend.adb (ADA.CALENDAR) package ....
   ---------
   -- "+" --
   --------- 
   function "+" (Left : Time; Right : Duration) return Time is
      pragma Unsuppress (Overflow_Check);
   begin
      return (Left + Time (Right));
   exception
      when Constraint_Error =>
         raise Time_Error;
   end "+";

   function "+" (Left : Duration; Right : Time) return Time is
      pragma Unsuppress (Overflow_Check);
   begin
      return (Time (Left) + Right);
   exception
      when Constraint_Error =>
         raise Time_Error;
   end "+";

From the a-reatim.adb (ADA.REAL_TIME) package ....
   ---------
   -- "+" --
   ---------
   --  Note that Constraint_Error may be propagated
   function "+" (Left : Time; Right : Time_Span) return Time is
   begin
      return Time (Duration (Left) + Duration (Right));
   end "+";

   function "+"  (Left : Time_Span; Right : Time) return Time is
   begin
      return Time (Duration (Left) + Duration (Right));
   end "+";

   function "+"  (Left, Right : Time_Span) return Time_Span is
   begin
      return Time_Span (Duration (Left) + Duration (Right));
   end "+";


   Am I doing something wrong in my attempt at usage of the Ada95 
REAL_TIME package, or is there something wrong with the package 
itself? Any help would be appreciated. Thanks in Advance.

drummond@nosc.mil
(619) 553-4131




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Gnat Ada95 REAL_TIME ANNEX problemS
       [not found] ` <199707251330.PAA20083@basement.replay.com>
@ 1997-07-29  0:00   ` JD
  0 siblings, 0 replies; 2+ messages in thread
From: JD @ 1997-07-29  0:00 UTC (permalink / raw)



Anonymous wrote:
> 
> On Thu, 24 Jul 1997 05:03:11 GMT, JD <drummond@nosc.mil> wrote:
> >    I have been using Ada83 and recently switched to Gnat 3.09 Ada95.
> > Part of the code I am writing utilizes timers. The Ada83 version of
> > the timer code had used the CALENDAR package, I am trying to change
> > this timer code to take advantage of the finer granularity found in
> > the Ada95 REAL_TIME package. I have read that `Calendar.Clock' and
> > `Real_Time.Clock' are implemented as transformations of the same
> > time base. However I can't seem to get the REAL_TIME package to work
> > with the "+", and "-" functions. The error from the compilier
> > is:
> > gnatmake -I../common1 temp_controller
> > gcc -c -I./ -I../common1 -I- ../common1/run_time_timer1.adb
> > run_time_timer1.adb:97:49: invalid operand types for operator "+"
> > run_time_timer1.adb:97:63: expected type "Standard.DURATION"
> > run_time_timer1.adb:97:63: found private type "Ada.Real_Time.Time"
> > gnatmake: "../common1/run_time_timer1.adb" compilation error
> > *** Error code 2
> > make: Fatal error: Command failed for target `all'
> ..
> 
> Was it really necessary to post this 5 times?
> 
> Since you haven't posted your code, we can't tell exactly what is wrong.
> >From this error message, however, it seems likely that you are using the
> types from Ada.Real_Time and the "+" from Ada.Calendar.
> 
> Jeff Carter  PGP:1024/440FBE21
 
  Thank you for the possible solution to my problem, I will ckeck this
out.
I am, however not using the line "with ADA.CALENDAR; use ADA.CALENDAR;, 
instead I am using "with ADA.REAL_TIME; use ADA.REAL_TIME; -shouldn't
this bring in the realtime package? 

  Also sorry about the multiple postings, the newsreader I am using
indicated an error every time I had sent a post, and seeing no result of
my post on the comp.lang.ada group I continued attempting to transmit a
news post. This
resulted in 5 unintended posts.

JD




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-07-29  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-24  0:00 Help, Gnat Ada95 REAL_TIME ANNEX problemS JD
     [not found] ` <199707251330.PAA20083@basement.replay.com>
1997-07-29  0:00   ` JD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox