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=0.8 required=3.0 tests=BAYES_50,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 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: eternal-september.org!reader02.eternal-september.org!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: Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: 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: Shark8 Injection-Date: Wed, 08 Sep 2021 22:00:45 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:62677 List-Id: 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;