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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!reality.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ok to assume type Duration is for more than one day? Date: Mon, 23 Jan 2017 14:47:09 -0600 Organization: JSA Research & Innovation Message-ID: References: <52d00223-69b9-4a5c-a2e0-aaa906d9b200@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1485204429 7686 24.196.82.226 (23 Jan 2017 20:47:09 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 23 Jan 2017 20:47:09 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:33137 Date: 2017-01-23T14:47:09-06:00 List-Id: Jeffrey R. Carter" wrote in message news:o628eh$2vi$1@dont-email.me... > On 01/22/2017 12:37 PM, reinkor wrote: >> As I understand from my textbook, type Duration is guaranteed to cover >> the range -86_400 .. 86_400 (number of seconds for one day). Does this >> mean that I take a considerable risk if I assume "Duration" can represent >> more than one day? > > Representing that range with an accuracy of 20 ms takes about 22 bits, so > most implementations will use at least 32 bits. The additional bits can be > used for a greater range, a smaller accuracy, or both. ±86,400 with an > accuracy of 20 µs takes about 32 bits, so a range of ±86,400 seems likely > for some 32-bit compilers. I believe that in Janus/Ada, we allowed +/- 2 days to make math a bit easier, but the limit is not wildly different than the textbook version. (I think we ignored the recommendation for 20 µs). It would be odd for a non-64-bit compiler to use a 64-bit Duration, as 64-bit operations are relatively expensive on smaller machines. Randy.