From: JD <drummond@nosc.mil>
Subject: HELP, Gnat Ada95 REAL_TIME package problems
Date: 1997/07/24
Date: 1997-07-24T00:00:00+00:00 [thread overview]
Message-ID: <33D70AB2.6B33@nosc.mil> (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. I am trying to use these functions
with DURATION type arguments. 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
next reply other threads:[~1997-07-24 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-07-24 0:00 JD [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-07-24 0:00 HELP, Gnat Ada95 REAL_TIME package problems JD
1997-07-24 0:00 JD
1997-07-24 0:00 Help, " JD
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox