Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #5992
| Subject | Re: Subtracting times |
|---|---|
| Newsgroups | comp.sys.acorn.programmer |
| From | Alan Adams <alan@adamshome.org.uk> |
| Date | 2020-02-21 12:45 +0000 |
| Message-ID | <2601c74558.Alan.Adams@ArmX6.adamshome.org.uk> (permalink) |
| References | <37f8364458.Alan.Adams@ArmX6.adamshome.org.uk> <0a59594458.jmb@jmc.bruck.orange.fr> <80ec8ad6-58f7-4862-8ccd-34d8d5627c3c@googlegroups.com> |
| Organization | Orpheus Internet Services |
In message <80ec8ad6-58f7-4862-8ccd-34d8d5627c3c@googlegroups.com>
Steve Drain <steve@kappa.me.uk> wrote:
> Michel wrote:
>> Alan Adams wrote:
>>> I need a BASIC routine to subtract one 5-byte time from another and return
>>> a correctly signed result.
>> from Steve Drain (ROOL Forum 18/12/2016)
>>
>> I wrote a library to support some of this this, as have others. It is a
>> candidate for Basalt, someday. ;-)
>>
>> Look at http://kappa.me.uk/Libraries/lbLongs032.zip
> I suspect that this problem has been satisfactorily solved in plain BASIC,
> but that library I wrote a good while ago uses fragments of assembly to do
> the heavy lifting, because of the carry etc.
In BASIC it has to be done byte-by-byte, or using half-words, so that the
borrow/carry can be detected.
> For interest's sake I put together a couple of routines to deal solely
> with 5-byte times using assembly at:
> http://www.kappa.me.uk/Miscellaneous/swTimeDiff.zip
> I am not sure that I have got it right, so please pull it apart. ;-)
It looks good. I'll test it in a bit.
The boundary conditions seem to be when the low word goes from 7fffffff to
80000000, when it goes from ffffffff to 00000000, and in each case when
the arguments swap.
Then there are the cases where the high bytes differ.
There's no way to indicate with an integer return, the result when the
high bytes differ by more than 1. Those cases are when the times are more
than a year and a half apart, so in my case, won't occur.
--
Alan Adams, from Northamptonshire
alan@adamshome.org.uk
http://www.nckc.org.uk/
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-18 11:55 +0000
Re: Subtracting times Jean-Michel <jmc.bruck@orange.fr> - 2020-02-18 19:11 +0100
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-21 03:28 -0800
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-21 12:45 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-21 15:17 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-22 10:37 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-25 16:05 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-25 16:35 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-27 17:10 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-27 10:06 -0800
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-28 11:21 +0000
Re: Subtracting times jeffrey.a.doggett@gmail.com - 2020-04-22 12:00 -0700
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-04-23 00:07 +0100
Re: Subtracting times jeffrey.a.doggett@gmail.com - 2020-04-23 03:13 -0700
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-04-23 18:01 +0100
Re: Subtracting times "John Williams (News)" <UCEbin@tiscali.co.uk> - 2020-04-23 18:06 +0100
Re: Subtracting times jeffrey.a.doggett@gmail.com - 2020-04-23 11:18 -0700
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-04-23 21:23 +0100
Re: Subtracting times David Higton <dave@davehigton.me.uk> - 2020-04-24 15:24 +0100
Re: Subtracting times David Higton <dave@davehigton.me.uk> - 2020-04-23 20:57 +0100
Re: Subtracting times jgh@mdfs.net - 2020-02-23 17:39 -0800
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-24 10:23 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-24 11:12 +0000
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-02-24 13:05 +0000
Re: Subtracting times Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-19 08:35 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-19 10:03 +0000
Re: Subtracting times Sebastian Barthel <naitsabes@freenet.de> - 2020-02-19 13:04 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-19 16:41 +0000
Re: Subtracting times jgh@mdfs.net - 2020-02-19 12:01 -0800
Re: Subtracting times Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-23 20:46 +0000
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-02-19 23:54 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-20 11:18 +0000
csiph-web