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.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!8nKyDL3nVTTIdBB8axZhRA.user.46.165.242.75.POSTED!not-for-mail From: Simon Wright 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 11:48:24 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: gioia.aioe.org; logging-data="49103"; posting-host="8nKyDL3nVTTIdBB8axZhRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:QmZ5jEuCbGWsPsGelX15dfT0zZg= Xref: reader02.eternal-september.org comp.lang.ada:63074 List-Id: reinert writes: > Ada seems to guarantee that Duration covers 24 hours (?). What you do > when you need to represent for example 5 years? This must depend on your use case. I'd imagine you want to arrange for some event to happen 5 years in the future. The 'natural' way to do this might be, in a task, delay until Ada.Calendar.Clock + Duration'({5 years}); but this comes up against two problems: first, as you note, that long a duration might not work, and second, the computer is almost certain to have been restarted by then, losing this task. The second problem could be solved by, e.g., keeping a backed-up time-ordered queue of events to be processed, with a task that delays until the next event is due. As for the first -- I think you may need to make an appropriate Duration'Last part of your compiler selection criteria.