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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a0fe76afdfe9e57d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-11 12:59:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!nwrdny02.gnilink.net.POSTED!53ab2750!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: Subject: Re: milliseconds and delay until X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Wed, 11 Jun 2003 19:59:14 GMT NNTP-Posting-Host: 141.154.200.68 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny02.gnilink.net 1055361554 141.154.200.68 (Wed, 11 Jun 2003 15:59:14 EDT) NNTP-Posting-Date: Wed, 11 Jun 2003 15:59:14 EDT Xref: archiver1.google.com comp.lang.ada:39006 Date: 2003-06-11T19:59:14+00:00 List-Id: "Thomas Bruns" wrote in message news:bc7smt$357$04$1@news.t-online.com... > Hello > > how can I handle the until delay statement, too do this: ???? Let us take one step back, and take a look at what the delay statement is supposed to accomplish. There are two different types of time measurements: - There are relative time values that specify the length of a span of time, e.g. "1 hour, 38 minutes, and 5.385 seconds", and - There are absolute time values that specify a particular point in time, e.g. "24 June 1987 06:58:05". In Ada, the Standard type Duration is used to represent relative time values. Duration is a real type representing the length of time in seconds. The range of Duration must be large enough to represent plus or minus one day. The Time type defined in Ada.Calendar represents an absolute time value, i.e. "24 June 1987 06:58:05". The Ada.Calendar package provides utilities for handling Time values, including the Clock function that returns the current time, and the various arithmentic operations between relative and absolute time. There are two forms of the delay statement. The relative delay statement takes the form delay Number_Of_Seconds; This form of the delay statement is used to delay for a certain time span, For example, to delay for one minute, you could use the relative delay statement delay 60.0; The other form of the delay statement is the "delay until" statement. This form delays until an absolute time is reached. It takes the delay until Time_Expression; Where Time_Expression is an Ada type (such as Ada.Calendar.Time) that represents an absolute time. For example, to delay until 12 June 2003, 6:30 in the morning, you could use the following "delay until" statement: procedure ... Secs_Per_Min : constant := 60.0; Secs_Per_Hour : constant := 60 * Secs_Per_Min; begin delay until Time_Of( Year => 2003, Month => 06 Day => 12 Seconds => 6 * Secs_Per_Hour + 30 * Secs_Per_Min ); end; Now on to your problem. If you wish to delay for a certain time span, e.g. delay for a tenth of a second; you should use the relative delay statement: delay 0.1; To delay until some absolute time, use the "delay until" statement. The Ada.Calendar package has the utilities you need to compute that absolute time. For example procedure ... The_Cows_Come_Home : Ada.Calendar.Time; begin -- Compute absolute time for "Delay Until" to be a tenth of a second from now. The_Cows_Come_Home := Ada.Calendar.Clock + 0.1; ... delay until The_Cows_Come_Home; end;