Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Backed up the system lately?


devel / comp.lang.ada / Trivial question: how to avoid confusing sec, min, hour and day in a program?

SubjectAuthor
* Trivial question: how to avoid confusing sec, min, hour and day in a program?reinert
`* Re: Trivial question: how to avoid confusing sec, min, hour and dayDmitry A. Kazakov
 +- Re: Trivial question: how to avoid confusing sec, min, hour and dayNiklas Holsti
 +* Re: Trivial question: how to avoid confusing sec, min, hour and dayldries46
 |+* Re: Trivial question: how to avoid confusing sec, min, hour and dayDmitry A. Kazakov
 ||+* Re: Trivial question: how to avoid confusing sec, min, hour and dayldries46
 |||`* Re: Trivial question: how to avoid confusing sec, min, hour and dayJ-P. Rosen
 ||| `* Re: Trivial question: how to avoid confusing sec, min, hour and dayldries46
 |||  `- Re: Trivial question: how to avoid confusing sec, min, hour and day in a programDennis Lee Bieber
 ||`- Re: Trivial question: how to avoid confusing sec, min, hour and dayAdaMagica
 |`- Re: Trivial question: how to avoid confusing sec, min, hour and dayShark8
 `* Re: Trivial question: how to avoid confusing sec, min, hour and dayreinert
  +* Re: Trivial question: how to avoid confusing sec, min, hour and dayJ-P. Rosen
  |`- Re: Trivial question: how to avoid confusing sec, min, hour and dayJeffrey R.Carter
  +- Re: Trivial question: how to avoid confusing sec, min, hour and dayG.B.
  +- Re: Trivial question: how to avoid confusing sec, min, hour and day in a programSimon Wright
  `- Re: Trivial question: how to avoid confusing sec, min, hour and dayBjörn Lundin

1
Trivial question: how to avoid confusing sec, min, hour and day in a program?

<c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5815&group=comp.lang.ada#5815

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:2297:: with SMTP id o23mr5834099qkh.405.1630825003991;
Sat, 04 Sep 2021 23:56:43 -0700 (PDT)
X-Received: by 2002:a25:af81:: with SMTP id g1mr8514146ybh.457.1630825003849;
Sat, 04 Sep 2021 23:56:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 4 Sep 2021 23:56:43 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
Subject: Trivial question: how to avoid confusing sec, min, hour and day in a program?
From: rein...@gmail.com (reinert)
Injection-Date: Sun, 05 Sep 2021 06:56:43 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 11
 by: reinert - Sun, 5 Sep 2021 06:56 UTC

Anybody with good ideas on how (in a simplest possible way) to avoid to confuse between representation of time as seconds, minutes, hours and days in an Ada program? Standardize on internal representation of time as seconds (Float)? I will delay to use complex approaches for physical units.

It is somewhere in my program natural/human to think in seconds whereas minutes or hours feels more natural at other places (so the numerics is "human"). Example to illustrate: heart rate is "natural" to give in number per minute (not in number per second, hour or day). Time on work is normally given by hours (not seconds) etc..

reinert

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sh1rha$14d6$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5816&group=comp.lang.ada#5816

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!x6YkKUCkj2qHLwbKnVEeag.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Date: Sun, 5 Sep 2021 09:27:38 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sh1rha$14d6$1@gioia.aioe.org>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="37286"; posting-host="x6YkKUCkj2qHLwbKnVEeag.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Sun, 5 Sep 2021 07:27 UTC

On 2021-09-05 08:56, reinert wrote:
> Anybody with good ideas on how (in a simplest possible way) to avoid to confuse between representation of time as seconds, minutes, hours and days in an Ada program?

Just use the standard type Duration.

> It is somewhere in my program natural/human to think in seconds whereas minutes or hours feels more natural at other places (so the numerics is "human"). Example to illustrate: heart rate is "natural" to give in number per minute (not in number per second, hour or day). Time on work is normally given by hours (not seconds) etc..

The user interface is responsible to convert anything to Duration and back.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<ipjsa9Fi441U1@mid.individual.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5818&group=comp.lang.ada#5818

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Date: Sun, 5 Sep 2021 15:42:49 +0300
Organization: Tidorum Ltd
Lines: 31
Message-ID: <ipjsa9Fi441U1@mid.individual.net>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net nHfJpfMszHNOHCEheXWcXwwXOPjjkiebpJhZ/vZICYS7GydqmW
Cancel-Lock: sha1:6XQD4xXmivJEW4PkLNQFJXQOA6w=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.13.0
In-Reply-To: <sh1rha$14d6$1@gioia.aioe.org>
Content-Language: en-US
 by: Niklas Holsti - Sun, 5 Sep 2021 12:42 UTC

On 2021-09-05 10:27, Dmitry A. Kazakov wrote:
> On 2021-09-05 08:56, reinert wrote:
>> Anybody with good ideas on how (in a simplest possible way) to avoid
>> to confuse between representation of time as seconds, minutes, hours
>> and days in an Ada program?
>
> Just use the standard type Duration.

But note that:

- Duration is a fixed-point type, not floating point, so it has a fixed
resolution, Duration'Small.

- The resolution and range of Duration are implementation-defined, and
the standard does not guarantee much. RM 9.6(27) says:

"The implementation of the type Duration shall allow representation of
time intervals (both positive and negative) up to at least 86400 seconds
(one day); Duration'Small shall not be greater than twenty milliseconds."

(Aside: I wonder why this paragraph is not in RM A.1, "The Package
Standard", where the Duration type is introduced.)

If you want your code to be portable, define your own type for "time in
seconds", choosing the properties your application needs.

That said, I believe that GNAT versions typically provide a 64-bit
Duration type that has enough precision and range for most applications
dealing with times on human scales. But perhaps not on nuclear,
geological or astrophysical scales.

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5832&group=comp.lang.ada#5832

 copy link   Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Newsgroups: comp.lang.ada
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
From: bertus.d...@planet.nl (ldries46)
Date: Mon, 6 Sep 2021 09:20:27 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <sh1rha$14d6$1@gioia.aioe.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
Message-ID: <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!feed.abavia.com!abe002.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 45
Injection-Date: Mon, 06 Sep 2021 09:20:28 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: ldries46 - Mon, 6 Sep 2021 07:20 UTC

Op 5-9-2021 om 9:27 schreef Dmitry A. Kazakov:
> On 2021-09-05 08:56, reinert wrote:
>> Anybody with good ideas on how (in a simplest possible way) to avoid
>> to confuse between representation of time as seconds, minutes, hours
>> and days in an Ada program?
>
> Just use the standard type Duration.
>
>> It is somewhere in my program natural/human to think in seconds
>> whereas  minutes or hours feels more natural at other places (so the
>> numerics is "human"). Example to illustrate: heart rate is "natural"
>> to give in number per minute (not in number per second, hour or day).
>> Time on work is normally given by hours (not seconds) etc..
>
> The user interface is responsible to convert anything to Duration and
> back.
>
I agree with Dimitry but I think the problem  is far bigger and not only
in Ada but in every computer language. You cannot use packages written
by others if you do not know the dimensions they use. For instance in
mechanical engineering in Europe there is a general use of cm while in
other countries they use inches and in aircraft engineering they use in
Europe mostly mm.
In general the use of dimensioning system ( f.i. cgs -cm gram second) is
different for different countries and application area's. Some factors
used within calculations are even dependant in the dimensioning system.
It would be a good idea if a package was developed that can solve all
these problems for instance by doing the calculations in one of the
possible dimensioning systems automagically presenting the results in
the dimension you choose.
Such a system must exist of a record for every value, that exist of at
least  real values for the standard dimensioning system and the value in
the dimensioning system you want, the factor between the two systems and
the string containing the dimension, perhaps even more.
There should be functions for "+", "-", "*", "/" and sqrt. The
calculation should be done for the value in the standard dimension while
the input and output must be in the wanted system. Also the strings and
factors must be changed when necessary.
I have already been thinking how but the problem are mostly in the
strings and the fact that there are also dimensions that have  a lower
limit (temperature) or have an offset (degrees Celcius, Reamur or
Fahrenheit) or exist of several integer values (time).
I think that the potential of Ada of being independent of an operating
system can be extended that way to independent of the dimensioning system.

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sh4o48$1ria$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5834&group=comp.lang.ada#5834

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!x6YkKUCkj2qHLwbKnVEeag.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Date: Mon, 6 Sep 2021 11:47:52 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sh4o48$1ria$1@gioia.aioe.org>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="61002"; posting-host="x6YkKUCkj2qHLwbKnVEeag.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Mon, 6 Sep 2021 09:47 UTC

On 2021-09-06 09:20, ldries46 wrote:
> Op 5-9-2021 om 9:27 schreef Dmitry A. Kazakov:
>> On 2021-09-05 08:56, reinert wrote:
>>> Anybody with good ideas on how (in a simplest possible way) to avoid
>>> to confuse between representation of time as seconds, minutes, hours
>>> and days in an Ada program?
>>
>> Just use the standard type Duration.
>>
>>> It is somewhere in my program natural/human to think in seconds
>>> whereas  minutes or hours feels more natural at other places (so the
>>> numerics is "human"). Example to illustrate: heart rate is "natural"
>>> to give in number per minute (not in number per second, hour or day).
>>> Time on work is normally given by hours (not seconds) etc..
>>
>> The user interface is responsible to convert anything to Duration and
>> back.
>>
> I agree with Dimitry but I think the problem  is far bigger and not only
> in Ada but in every computer language. You cannot use packages written
> by others if you do not know the dimensions they use. For instance in
> mechanical engineering in Europe there is a general use of cm while in
> other countries they use inches and in aircraft engineering they use in
> Europe mostly mm.

Why do you need that? If written in Ada, the value is of some separate
numeric type you could not mix with other types.

> In general the use of dimensioning system ( f.i. cgs -cm gram second) is
> different for different countries and application area's. Some factors
> used within calculations are even dependant in the dimensioning system.
> It would be a good idea if a package was developed that can solve all
> these problems for instance by doing the calculations in one of the
> possible dimensioning systems automagically presenting the results in
> the dimension you choose.

If calculations are involved, they are performed in SI, because
otherwise you need factors in all formulae. And SI means no mm, but m,
no km/h, but m/s etc.

> Such a system must exist of a record for every value, that exist of at
> least  real values for the standard dimensioning system and the value in
> the dimensioning system you want, the factor between the two systems and
> the string containing the dimension, perhaps even more.
> There should be functions for "+", "-", "*", "/" and sqrt.

http://www.dmitry-kazakov.de/ada/units.htm

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5835&group=comp.lang.ada#5835

 copy link   Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Newsgroups: comp.lang.ada
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
<sh4o48$1ria$1@gioia.aioe.org>
From: bertus.d...@planet.nl (ldries46)
Date: Mon, 6 Sep 2021 15:06:17 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <sh4o48$1ria$1@gioia.aioe.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
Message-ID: <nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe002.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 71
Injection-Date: Mon, 06 Sep 2021 15:06:19 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 4541
 by: ldries46 - Mon, 6 Sep 2021 13:06 UTC

Op 6-9-2021 om 11:47 schreef Dmitry A. Kazakov:
> On 2021-09-06 09:20, ldries46 wrote:
>> Op 5-9-2021 om 9:27 schreef Dmitry A. Kazakov:
>>> On 2021-09-05 08:56, reinert wrote:
>>>> Anybody with good ideas on how (in a simplest possible way) to
>>>> avoid to confuse between representation of time as seconds,
>>>> minutes, hours and days in an Ada program?
>>>
>>> Just use the standard type Duration.
>>>
>>>> It is somewhere in my program natural/human to think in seconds
>>>> whereas  minutes or hours feels more natural at other places (so
>>>> the numerics is "human"). Example to illustrate: heart rate is
>>>> "natural" to give in number per minute (not in number per second,
>>>> hour or day). Time on work is normally given by hours (not seconds)
>>>> etc..
>>>
>>> The user interface is responsible to convert anything to Duration
>>> and back.
>>>
>> I agree with Dimitry but I think the problem  is far bigger and not
>> only in Ada but in every computer language. You cannot use packages
>> written by others if you do not know the dimensions they use. For
>> instance in mechanical engineering in Europe there is a general use
>> of cm while in other countries they use inches and in aircraft
>> engineering they use in Europe mostly mm.
>
> Why do you need that? If written in Ada, the value is of some separate
> numeric type you could not mix with other types.

I do need that because you can use the same packages in different
trades. If you want to calculate the inertia of a construction dependent
on the location or the trade you are working in you use different
dimension systems. Indeed you can use SI but most mechanical engineers
use the cm as a basic unit while aeronautical engineers use the mm as
there basic unit and the result differ with 4 zero's. In the USA they
probably use inches which differ some incredible factors. if an American
uses a European standard HE100 element in his calculations he has first
to recalculate all inertia values. This will lead to greater error
possibilities.
>
>> In general the use of dimensioning system ( f.i. cgs -cm gram second)
>> is different for different countries and application area's. Some
>> factors used within calculations are even dependant in the
>> dimensioning system.
>> It would be a good idea if a package was developed that can solve all
>> these problems for instance by doing the calculations in one of the
>> possible dimensioning systems automagically presenting the results in
>> the dimension you choose.
>
> If calculations are involved, they are performed in SI, because
> otherwise you need factors in all formulae. And SI means no mm, but m,
> no km/h, but m/s etc.
Sorry but It should perhaps be so but it is not. Programs made primarily
for Aircraft engineering (f.i. CATIA 5/6) do use mm and your velocity
clock in your car shows km/h and it registers the distance in km (in
England and the USA mph and miles) In aircraft the Speed is often still
measured in Knots (Nautical miles per hour). Maybe French aircraft will
possibly show km/h. It is to hazardous to change this
>
>
>> Such a system must exist of a record for every value, that exist of
>> at least  real values for the standard dimensioning system and the
>> value in the dimensioning system you want, the factor between the two
>> systems and the string containing the dimension, perhaps even more.
>> There should be functions for "+", "-", "*", "/" and sqrt.
>
>    http://www.dmitry-kazakov.de/ada/units.htm
>

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sh55uj$6uv$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5836&group=comp.lang.ada#5836

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Date: Mon, 6 Sep 2021 15:43:45 +0200
Organization: Adalog
Lines: 21
Message-ID: <sh55uj$6uv$1@dont-email.me>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
<sh4o48$1ria$1@gioia.aioe.org> <nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 6 Sep 2021 13:43:47 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f8252d7076c4a6ff7ed555515a3a18bd";
logging-data="7135"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tzvLpUP0l4oD2cpl3MXUV"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:j4N9QMdpr3mI4neo5JHJbwxxfV4=
In-Reply-To: <nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a>
Content-Language: fr
 by: J-P. Rosen - Mon, 6 Sep 2021 13:43 UTC

Le 06/09/2021 à 15:06, ldries46 a écrit :
>> If calculations are involved, they are performed in SI, because
>> otherwise you need factors in all formulae. And SI means no mm, but m,
>> no km/h, but m/s etc.
> Sorry but It should perhaps be so but it is not. Programs made primarily
> for Aircraft engineering (f.i. CATIA 5/6) do use mm and your velocity
> clock in your car shows km/h and it registers the distance in km (in
> England and the USA mph and miles) In aircraft the Speed is often still
> measured in Knots (Nautical miles per hour). Maybe French aircraft will
> possibly show km/h. It is to hazardous to change this

Do not confuse computations with input/output. I agree with Dmitry, all
computations should be performed in SI, with a (user selectable) choice
of units for input and display.

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<nnd$6e6f7f2d$14e49575@19879327cd7b9d67>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5837&group=comp.lang.ada#5837

 copy link   Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
Newsgroups: comp.lang.ada
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
<sh4o48$1ria$1@gioia.aioe.org> <nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a>
<sh55uj$6uv$1@dont-email.me>
From: bertus.d...@planet.nl (ldries46)
Date: Mon, 6 Sep 2021 16:13:36 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <sh55uj$6uv$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
Message-ID: <nnd$6e6f7f2d$14e49575@19879327cd7b9d67>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe001.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 26
Injection-Date: Mon, 06 Sep 2021 16:13:37 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2544
 by: ldries46 - Mon, 6 Sep 2021 14:13 UTC

Op 6-9-2021 om 15:43 schreef J-P. Rosen:
> Le 06/09/2021 à 15:06, ldries46 a écrit :
>>> If calculations are involved, they are performed in SI, because
>>> otherwise you need factors in all formulae. And SI means no mm, but
>>> m, no km/h, but m/s etc.
>> Sorry but It should perhaps be so but it is not. Programs made
>> primarily for Aircraft engineering (f.i. CATIA 5/6) do use mm and
>> your velocity clock in your car shows km/h and it registers the
>> distance in km (in England and the USA mph and miles) In aircraft the
>> Speed is often still measured in Knots (Nautical miles per hour).
>> Maybe French aircraft will possibly show km/h. It is to hazardous to
>> change this
>
> Do not confuse computations with input/output. I agree with Dmitry,
> all computations should be performed in SI, with a (user selectable)
> choice of units for input and display.
>
What I tried to say is just what J-P Rosen says. But in my experience
(41 years in aircraft engineering) that is not so, every time you have
to realise what the system your working with and you are forced to even
use systems parallel. One of the points I made the mechanical
engineering which often uses cm has standard profiles using mm HE110B is
100mm high. That is the reason that I ask for a package which solves
this problem for once and always and still gives the user the
possibility to use all kind of dimesions

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<9jbcjgpc5mqo8e9eojc3pbs13vtpejm9pl@4ax.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5838&group=comp.lang.ada#5838

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 06 Sep 2021 10:10:49 -0500
From: wlfr...@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.ada
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?
Date: Mon, 06 Sep 2021 11:10:49 -0400
Organization: IISS Elusive Unicorn
Message-ID: <9jbcjgpc5mqo8e9eojc3pbs13vtpejm9pl@4ax.com>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com> <sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394> <sh4o48$1ria$1@gioia.aioe.org> <nnd$563ecd8c$31afcc12@91591a5cbc3e1e9a> <sh55uj$6uv$1@dont-email.me> <nnd$6e6f7f2d$14e49575@19879327cd7b9d67>
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: yes
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 16
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-VjeaD2z1s4xW0EN/FVHjBSJBPudAf4yMwlfF8nCvA3izA9/RFIkZGqKM4bmN+KwCsYHHrR4r4pVCHAY!tl1IYX1gEdERxnTK6NTXFy0JQQkiUsFOUMiq6EtCl9hhBA/HbHw22Fr6Wcyu5gnn/njYyL5x
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2061
X-Received-Bytes: 2240
 by: Dennis Lee Bieber - Mon, 6 Sep 2021 15:10 UTC

On Mon, 6 Sep 2021 16:13:36 +0200, ldries46 <bertus.dries@planet.nl>
declaimed the following:

>100mm high. That is the reason that I ask for a package which solves
>this problem for once and always and still gives the user the
>possibility to use all kind of dimesions

So... a reimplementation of the HP-48 UNITS module... Which requires
all values to have a unit designation attached (eg: 1.6_km) and internally
probably tracks the input unit but converts to base (SI) units for
computations, then remaps to user input units for display.

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<9ff0ffdc-f224-4535-8149-312d751fcc43n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5839&group=comp.lang.ada#5839

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:ab15:: with SMTP id u21mr11736815qke.439.1630943757675;
Mon, 06 Sep 2021 08:55:57 -0700 (PDT)
X-Received: by 2002:a25:b782:: with SMTP id n2mr17589301ybh.159.1630943757492;
Mon, 06 Sep 2021 08:55:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Mon, 6 Sep 2021 08:55:57 -0700 (PDT)
In-Reply-To: <sh4o48$1ria$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=94.31.103.138; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf
NNTP-Posting-Host: 94.31.103.138
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394> <sh4o48$1ria$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9ff0ffdc-f224-4535-8149-312d751fcc43n@googlegroups.com>
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
From: christ-u...@t-online.de (AdaMagica)
Injection-Date: Mon, 06 Sep 2021 15:55:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: AdaMagica - Mon, 6 Sep 2021 15:55 UTC

Dmitry A. Kazakov schrieb am Montag, 6. September 2021 um 11:47:54 UTC+2:
> http://www.dmitry-kazakov.de/ada/units.htm

http://archive.adaic.com/tools/CKWG/Dimension/Dimension.html

You might try to improve one of those packages for your needs.

Don't know what HE110B is.

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<703427c2-6ecc-4142-9adb-f12d0f9708e0n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5855&group=comp.lang.ada#5855

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:6451:: with SMTP id y78mr306530qkb.427.1631138445251;
Wed, 08 Sep 2021 15:00:45 -0700 (PDT)
X-Received: by 2002:a25:7e46:: with SMTP id z67mr627675ybc.166.1631138445034;
Wed, 08 Sep 2021 15:00:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 8 Sep 2021 15:00:44 -0700 (PDT)
In-Reply-To: <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC
NNTP-Posting-Host: 146.5.2.231
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org> <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <703427c2-6ecc-4142-9adb-f12d0f9708e0n@googlegroups.com>
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
From: onewinge...@gmail.com (Shark8)
Injection-Date: Wed, 08 Sep 2021 22:00:45 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 23
 by: Shark8 - Wed, 8 Sep 2021 22:00 UTC

On Monday, September 6, 2021 at 1:22:03 AM UTC-6, ldries46 wrote:
> It would be a good idea if a package was developed that can solve all
> these problems for instance by doing the calculations in one of the
> possible dimensioning systems automagically presenting the results in
> the dimension you choose.
There's this package[-set] -- http://archive.adaic.com/tools/CKWG/Dimension/SI.html
which is really pretty nice, and addresses the concern.

> I have already been thinking how but the problem are mostly in the strings
Strings are terrible, avoid thinking in strings; be about the data first and foremost.
Strings should, inasmuch as possible, be used only in your UI; e.g. given a MVC structure only the VIEW should deal with Strings.

> I think that the potential of Ada of being independent of an operating
> system can be extended that way to independent of the dimensioning system.
Possibly, the problem is addressed interestingly in VHDL via "physical units" where you can define a type and then use units with a conversion factor.
Example:

Type Avoirdupois_Weight is range 0 to 1E9 units
Grain;
Dram = 27.34375 Grain;
Ounce = 16.0 Dram;
Pound = 16.0 Ounce;
Ton = 2_000.0 Pound
end units Avoirdupois_Weight;

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6243&group=comp.lang.ada#6243

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:e8c5:: with SMTP id m5mr4788206qvo.33.1635058338121;
Sat, 23 Oct 2021 23:52:18 -0700 (PDT)
X-Received: by 2002:a5b:cce:: with SMTP id e14mr9338272ybr.486.1635058337936;
Sat, 23 Oct 2021 23:52:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 23 Oct 2021 23:52:17 -0700 (PDT)
In-Reply-To: <sh1rha$14d6$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com> <sh1rha$14d6$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day
in a program?
From: rein...@gmail.com (reinert)
Injection-Date: Sun, 24 Oct 2021 06:52:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: reinert - Sun, 24 Oct 2021 06:52 UTC

Ada seems to guarantee that Duration covers 24 hours (?). What you do when you need to represent for example 5 years?

reinert

søndag 5. september 2021 kl. 09:27:41 UTC+2 skrev Dmitry A. Kazakov:
> On 2021-09-05 08:56, reinert wrote:
> > Anybody with good ideas on how (in a simplest possible way) to avoid to confuse between representation of time as seconds, minutes, hours and days in an Ada program?
> Just use the standard type Duration.
> > It is somewhere in my program natural/human to think in seconds whereas minutes or hours feels more natural at other places (so the numerics is "human"). Example to illustrate: heart rate is "natural" to give in number per minute (not in number per second, hour or day). Time on work is normally given by hours (not seconds) etc..
> The user interface is responsible to convert anything to Duration and back.
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sl31nr$li0$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6245&group=comp.lang.ada#6245

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
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 09:24:46 +0200
Organization: Adalog
Lines: 31
Message-ID: <sl31nr$li0$1@dont-email.me>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
<5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Oct 2021 07:24:43 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="72f300d732b5b28c170baeb80b9d0c7a";
logging-data="22080"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/0qLG347mlwqdUXL6RzUF"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:i9NtaJDcrQfZ7zQUMcprLDVMGBE=
In-Reply-To: <5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>
Content-Language: fr
 by: J-P. Rosen - Sun, 24 Oct 2021 07:24 UTC

Le 24/10/2021 à 08:52, reinert a écrit :
> Ada seems to guarantee that Duration covers 24 hours (?). What you do when you need to represent for example 5 years?
Ada /guarantees/ at least 24 hours, since subtype Day_Duration
corresponds to one day.

In practice, Duration is much bigger. There is no requirement for it,
since it obviously depends on the implementation. With Gnat, the
following program:

with Text_Io; use Text_Io;
procedure Test_Duration is
package Duration_Io is new Fixed_Io (Duration);
use Duration_Io;
begin
null;
Put ("duration'last:"); Put (Duration'Last); New_Line;
Put ("days:") ; Put (Duration'Last / 86400); New_Line;
Put ("years:") ; Put (Duration'Last / 86400 / 365.25); New_Line;
end;

gives:
duration'last: 9223372036.854775807
days: 106751.991167300
years: 292.271023045

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sl3bac$8r8$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6246&group=comp.lang.ada#6246

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (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
Lines: 10
Message-ID: <sl3bac$8r8$1@dont-email.me>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
<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
 by: G.B. - Sun, 24 Oct 2021 10:08 UTC

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.

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sl3d58$c91$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6247&group=comp.lang.ada#6247

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
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:39:34 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <sl3d58$c91$1@dont-email.me>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
<5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>
<sl31nr$li0$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Oct 2021 10:39:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2ee275d70c76e7dea54848225e287024";
logging-data="12577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++JUYC3cD7p31CiqTQfp+ATRiG+bjHqZE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:RP2Fle5XfVsa7/Z2pfcoO9y8jtU=
In-Reply-To: <sl31nr$li0$1@dont-email.me>
Content-Language: en-US
 by: Jeffrey R.Carter - Sun, 24 Oct 2021 10:39 UTC

On 10/24/21 09:24, J-P. Rosen wrote:
>
>    Put ("years:") ;  Put (Duration'Last / 86400 / 365.25); New_Line;

Still using the Julian calendar? In the Common calendar, the average
length of a year is 365.2425 days (97 leap years every 400 years).

> years:        292.271023045

Should be 292.277024627

--
Jeff Carter
"Any extraterrestrials reported are always
described as essentially human in form,
which is so unlikely a possibility that we
can dismiss it out of hand."
Extraterrestrial Civilizations
168

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<ly1r4absw7.fsf@pushface.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6248&group=comp.lang.ada#6248

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!8nKyDL3nVTTIdBB8axZhRA.user.46.165.242.75.POSTED!not-for-mail
From: sim...@pushface.org (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: <ly1r4absw7.fsf@pushface.org>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
<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=
 by: Simon Wright - Sun, 24 Oct 2021 10:48 UTC

reinert <reinkor@gmail.com> 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.

Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?

<sl3idr$ghe$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=6249&group=comp.lang.ada#6249

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: b.f.lun...@gmail.com (Björn Lundin)
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 14:09:30 +0200
Organization: A noiseless patient Spider
Lines: 77
Message-ID: <sl3idr$ghe$1@dont-email.me>
References: <c1e4f8bf-f3f0-4a14-b057-37f330461f9cn@googlegroups.com>
<sh1rha$14d6$1@gioia.aioe.org>
<5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Oct 2021 12:09:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f6cedc6941dbf2fd9cfb18f3afeccc43";
logging-data="16942"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hsN9S1NrfrukV14jpWot+"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0)
Gecko/20100101 Thunderbird/78.14.0
Cancel-Lock: sha1:TN3R8aU0pmo5JXg2ck8benpAq2c=
In-Reply-To: <5dcbccb3-1e2b-42cb-91e1-4be31442a647n@googlegroups.com>
Content-Language: sv
 by: Björn Lundin - Sun, 24 Oct 2021 12:09 UTC

Den 2021-10-24 kl. 08:52, skrev reinert:
> Ada seems to guarantee that Duration covers 24 hours (?). What you do when you need to represent for example 5 years?

we use a types of our own at work

subtype Year_Type is Integer_2 range 1901 .. 2099;
subtype Month_Type is Integer_2 range 01 .. 12;
subtype Day_Type is Integer_2 range 01 .. 31;
subtype Hour_Type is Integer_2 range 00 .. 23;
subtype Minute_Type is Integer_2 range 00 .. 59;
subtype Second_Type is Integer_2 range 00 .. 59;
subtype Millisecond_Type is Integer_2 range 000 .. 999;

subtype Week_Type is Integer_2 range 1 .. 53;
subtype Year_Day_Type is Integer_2 range 1 .. 366;
type Week_Day_Type is (
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday);

subtype Interval_Day_Type is Integer_4 range 0 .. Integer_4'Last;
subtype Seconds_Type is Integer_4 range 0 .. Integer_4'Last;

type Time_Type is tagged record
Year : Year_Type;
Month : Month_Type;
Day : Day_Type;
Hour : Hour_Type;
Minute : Minute_Type;
Second : Second_Type;
Millisecond : Millisecond_Type;
end record;

and

type Interval_Type is tagged record
Days : Interval_Day_Type;
Hours : Hour_Type;
Minutes : Minute_Type;
Seconds : Second_Type;
Milliseconds : Millisecond_Type;
end record;

with functions and conversion to handle

"+" "-" and some more ( Time - Time results in duration)

we have a limited need of dates from the past and into the future, and
ms is usually enough granularity.
(This was designed in the late 80:ies but still usefull)

This is to cover the needs of our administrative system

>> The user interface is responsible to convert anything to Duration and back.
>>
>> --
>> Regards,
>> Dmitry A. Kazakov
>> http://www.dmitry-kazakov.de

and Dmitry is right in saying the user interface should convert to the
units the user likes

--
Björn

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor