[futurebasic] Re: [FB] [XFB] SANE comp sending me INSANE

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2002 : Group Archive : Group : All Groups

From: Heather Donahue <maclists@...>
Date: Tue, 05 Nov 2002 14:51:46 -0800
I've hesitated responding to this thread, I'm not sure if I can help that
much.


On 11/5/02 2:30 AM, "Ashley Butterworth" <macbse@...> wrote:

> 
> On Monday, November 4, 2002, at 11:13 , Nancy Mann wrote:
> 
>> 
>> Sorry Ashley,
>> 
>> I can read a bit of C, but can't write it
>> 
>> Regards
>> 
>> Ian
>> 
> 
> 
> Thanks, I can take FB code and translate it into C but I can't translate
> the assembly. That is processor independent and I will eventually have
> to run (at least the core of the program) on a computer with a intel
> chip in it and running linux or some other unix derivative.

The assembly code that Ian mentioned just calls some Mac ToolBox functions
to convert between 64 bit integers and doubles.  These of course won't help
with the time format.
 
> I know how I can break the number up into manageable 32 bit chunks but
> all I know about the SANE format is that it was cooked up by Apple and
> it is only on Macs. I need to be able to translate to and from this data
> on any platform (mac, linux, unix, (heaven forbid) windows).

I don't think there is really anything special about the SANE format.  It's
my understanding that it's really a sign extended version of the Apple 32
bit time format.  It's not compatible with the Standard C time format.

The time is based on seconds from 12:00:00 1/1/1904 which is a LongDateTime
of zero  The first 32 bits give you a date around 2040

The sign, the high bit of the second 32 bits, allows dates before 12:00:00
1/1/1904  If you were to use the full 64 bits, you'd have a range of many
billions of years.

Apple provides functions to modify the date based on masks.  My guess is
it's pretty difficult, having to account for each second of each year, each
month, each day, including leap years, etc.  Plus you have to decide what
type of year you want to, or need to, work with.

Unless you can find an open-source 64 bit time library, you'll have to write
your own.  I'm sure there are some but I'd wonder if they use the same
format as Apple does.

P.S. Out of curiosity, I looked up SANE, it's rather dead now, but SANE
supported 80 bit floating point and 96 bit fp on a machine (68k) with a
co-processor.  Part of the floating point is stored in the lower 64 bits.
My guess is that this is where the 64 bit SANE comp format came from, as you
could use this for 64 bit integer computations.