From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,412452366233cd28,start X-Google-Attributes: gid103376,public From: JD Subject: Help, Gnat Ada95 REAL_TIME ANNEX problemS Date: 1997/07/24 Message-ID: <33D6E20F.4633@nosc.mil>#1/1 X-Deja-AN: 258536874 Sender: news@nosc.mil Organization: NCCOSC RDT&E Division, San Diego, CA Reply-To: drummond@nosc.mil Newsgroups: comp.lang.ada Date: 1997-07-24T00:00:00+00:00 List-Id: 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