From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.3 required=3.0 tests=BAYES_00,NICE_REPLY_A, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day in a program? Date: Sun, 24 Oct 2021 12:08:12 +0200 Organization: A noiseless patient Spider Message-ID: References: <5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 24 Oct 2021 10:08:12 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="f02018d0187bacef89204bb0acc49c00"; logging-data="9064"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dLXNwTWWfpkNZm6n058U+rOyM78yaFdw=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Cancel-Lock: sha1:s54Jh0C7hemo2aWB29b/CKYPDsA= In-Reply-To: <5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:63072 List-Id: On 24.10.21 08:52, reinert wrote: > Ada seems to guarantee that Duration covers 24 hours (?). What you do when you need to represent for example 5 years? The computing apparatus running the program might not always be on. "Always" is a reference to real time. So when it's turned off, a duration object in the program would incur lost time. So, some form of persistent storage is needed. I'd use values of types that allow computing offsets in time. Store these every now and then, e.g., as representing time passed.