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,ffa5a82d3c57141e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-11 19:52:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi_feed3!attbi.com!sccrnsc04.POSTED!not-for-mail From: "SteveD" Newsgroups: comp.lang.ada References: Subject: Re: Help - time to string query X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 12.211.13.75 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc04 1039665124 12.211.13.75 (Thu, 12 Dec 2002 03:52:04 GMT) NNTP-Posting-Date: Thu, 12 Dec 2002 03:52:04 GMT Organization: AT&T Broadband Date: Thu, 12 Dec 2002 03:52:04 GMT Xref: archiver1.google.com comp.lang.ada:31719 Date: 2002-12-12T03:52:04+00:00 List-Id: "TAMS Team" wrote in message news:at6t3k$n63$1$830fa7a5@news.demon.co.uk... > Hi! > > Hopefully this is a very simple question (from a very simple programmer!). > I'm using a parameter of type ada.real_time.time in my program and I need to > be able to convert this into a string. Can't suss how to achieve this, and > it's getting to the brick wall/head banging stage. I'm sure I should be > using something like 'image, but can't figure out how to do it. > > How do I do it?! Ada provides two packages for dealing with time: Ada.Calendar and Ada.Real_Time. If you want to deal with time as in time of day use Ada.Calendar. If you want to deal with time as in measuring or delaying for precise times use Ada.Real_Time. Time values returned from Ada.Real_Time reflect the time since "epoch" (LRM A.8.28) which may have no particular relation to the time of day. The difference between two Ada.Real_Time.Time values is calculated using the "-" operator and results in a value of type Ada.Real_Time.Time_Span. The function Ada.Real_Time.To_Duration can be used to convert a time span to a "Duration" which may be converted to a floating point value of seconds. I often use Ada.Real_Time to do precise timing. Forr example: start_Time := Ada.Real_Time.Clock; for I in A'range loop Processing( A(I) ); end loop; End_Time := Ada.Real_Time.Clock; Text_Io.Put( "Time for array based loop is " ); Float_Text_Io.Put( Float( Ada.Real_Time.To_Duration( end_Time - Start_TIme ) ), 3, 5, 0 ); Text_Io.New_Line; Oh, and sorry if I'm off target on what you're asking. Steve (The Duck) > Cheers, > > Mike Clarke > >