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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,30bb735cf84485f7 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z38g2000hsc.googlegroups.com!not-for-mail From: george.priv@gmail.com Newsgroups: comp.lang.ada Subject: Re: delay until problem in Windows Date: Wed, 9 Apr 2008 07:56:25 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9bfa59b1-c5ef-42ee-9d2a-729d215293a3@a1g2000hsb.googlegroups.com> NNTP-Posting-Host: 151.196.71.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207752985 13630 127.0.0.1 (9 Apr 2008 14:56:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 Apr 2008 14:56:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z38g2000hsc.googlegroups.com; posting-host=151.196.71.114; posting-account=VnNb3AoAAACTpRtCcTrcjmPX7cs92k1Q User-Agent: G2/1.0 X-HTTP-Via: 1.1 SPARKS X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20873 Date: 2008-04-09T07:56:25-07:00 List-Id: On Apr 7, 3:25 am, "Dmitry A. Kazakov" wrote: > On Sun, 6 Apr 2008 20:10:38 -0700 (PDT), george.p...@gmail.com wrote: > > On Apr 5, 6:51 pm, george.p...@gmail.com wrote: > > [...] > > > with Ada.Calendar; > > use Ada.Calendar; > > I don't know the implementation of, but Ada.Calendar is a political time, > influenced by the time synchronization stuff. What happens if you replace > it by Ada.Real_Time? > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de You were right: so far the Real_Time version is running for 48 hours without failing. So that may be a workaround. with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; --with Ada.RealFormatting; with Ada.Calendar.Formatting; procedure Delay_RT is Start_Time : Time := Clock; Time_Failed : Time := Start_Time; ST : Ada.Calendar.Time := Ada.Calendar.Clock; FT : Ada.Calendar.Time := ST; task Delay_Test_Tsk is entry Term; end Delay_Test_Tsk; task body Delay_Test_Tsk is DT : constant Time_Span := Seconds (10); -- Desired Delta T Time_For_Next : Time := Clock + DT; -- Next cycle Last : Time := Clock; -- Last cycle clocked Fail_Count : Natural := 0; begin while Fail_Count < 5 loop select accept Term; exit; or delay until Time_For_Next; declare Actual_Delta : Time_Span := Clock - Last; begin Last := Clock; Time_For_Next := Last + DT; Put_Line("Actual Delay: " & Duration'Image(To_Duration( Actual_Delta)) & ", Running (h):" & Duration'Image(To_Duration(Clock - Start_Time)/ 3600.0)); if Actual_Delta < DT or Actual_Delta > (DT + Seconds(1)) then if Fail_Count = 0 then Time_Failed := Clock; FT := Ada.Calendar.Clock; end if; Fail_Count := Fail_Count + 1; else Fail_Count := 0; end if; end; end select; end loop; Put_Line("Started at:" & Ada.Calendar.Formatting.Image(ST)); if Time_Failed /= Start_Time then Put_Line("Failed at :" & Ada.Calendar.Formatting.Image(FT)); Put_Line("Failed after :" & Duration'Image(To_Duration( Time_Failed - Start_Time))); end if; end Delay_Test_Tsk; Line : String (1 .. 80); Last : Natural; begin loop Get_Line(Line, Last); exit when Line(1) = 'q' or Line(1) = 'Q'; end loop; Delay_Test_Tsk.Term; end Delay_RT;