comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada.Real_Time.Time_Last
Date: Wed, 15 Nov 2017 22:03:52 +0200
Date: 2017-11-15T22:03:52+02:00	[thread overview]
Message-ID: <f73kt9F818aU1@mid.individual.net> (raw)
In-Reply-To: <lyr2szehuo.fsf@pushface.org>

On 17-11-15 16:28 , Simon Wright wrote:
> The only use case I can see for this is to allow us to write
>
>    delay until Ada.Real_Time.Time_Last;
>
> at the end of our (Ravenscar) main program. Any other offers?

Suppose your program has to consider, say, three possible future events, 
at the future times A, B, C : Ada.Real_Time.Time, and must delay until 
the first of those events happens, so you compute a variable Next_Event 
: Ada.Real_Time.Time as the minimum of A, B, and C, and then do "delay 
until Next_Time".

However, if some or all of the events A, B, C might never happen, the 
value Time_Last is a useful placeholder to indicate "this event will 
never happen", because Time_Last is a "neutral element" for the 
operation "minimum of two Time values": minimum (X, Time_Last) = X for 
any Time X.

Many algorithms working with ordered types need a minimal and a maximal 
value of the type, for such uses.

(By the way, my Ravenscar programs always end in an eternal loop, never 
in a delay until Time_Last.)

(By the further way, it is a pity that Ada does not let Ada.Real_Time 
provide the attribute functions Time'Min and Time'Max.)

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

  reply	other threads:[~2017-11-15 20:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 14:28 Ada.Real_Time.Time_Last Simon Wright
2017-11-15 20:03 ` Niklas Holsti [this message]
2017-11-17  9:20   ` Ada.Real_Time.Time_Last Simon Wright
2017-11-17 21:39     ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 13:06       ` Ada.Real_Time.Time_Last AdaMagica
2017-11-18 13:18         ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 14:00           ` Ada.Real_Time.Time_Last AdaMagica
2017-11-18 14:15           ` Ada.Real_Time.Time_Last Jeffrey R. Carter
2017-11-18 15:24             ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 16:01               ` Ada.Real_Time.Time_Last Dmitry A. Kazakov
2017-11-18 17:31                 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 22:20               ` Ada.Real_Time.Time_Last Robert A Duff
2017-11-19 10:50                 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-20  5:57                 ` Ada.Real_Time.Time_Last J-P. Rosen
2019-01-29 22:03       ` Ada.Real_Time.Time_Last Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox