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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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-12 13:27:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: milliseconds and delay until Date: 12 Jun 2003 21:26:24 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1055449628 11866 62.49.19.209 (12 Jun 2003 20:27:08 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 12 Jun 2003 20:27:08 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.93 Xref: archiver1.google.com comp.lang.ada:39063 Date: 2003-06-12T21:26:24+01:00 List-Id: "Steve" writes: > Instead of using Ada.Calendar, have a look at Ada.Real_Time; > > Then you should be able to do something like (tested): > > with Ada.Real_Time; > > procedure Rt_Demo is > > package Real_Time renames Ada.Real_Time; > use type Real_Time.Time_Span; > use type Real_Time.Time; > > Start_Time : Real_Time.Time; > Target_Time : Real_Time.Time; > > begin > Start_Time := Real_Time.Clock; > Target_Time := Start_Time + Real_Time.Milliseconds( 100 ); > delay until Target_Time; > end Rt_Demo; > > My rule of thumb on deciding whether to use Ada.Calendar versus > Ada.Real_Time is: > Use Ada.Calendar when you want numbers to print on a report. > Use Ada.Real_Time when you want to do delays for timing. > > Most of the work I do is time sensitive, where delays of more than a > few tens of milliseconds are not tolerated for some operation. I > use Ada.Real_Time most of the time. This depends on your compiler's runtime. I think you will find for GNAT that it makes very little difference (certainly 3.15a1 fails to comply with ARM D.8(32), "A clock jump is the difference between two successive distinct values of the clock (as observed by calling the Clock function). There shall be no backward clock jumps.". Of course on a desktop machine it may be hard to manage this! but it would have been nice if the VxWorks version had done so.)