🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.acorn.tech
3 messages
3 total messages Started by Peter Gutmann Fri, 09 Oct 1992 00:48
Archimedes <-> Unix timestamp conversion
#271
Author: Peter Gutmann
Date: Fri, 09 Oct 1992 00:48
20 lines
1209 bytes
Does anyone know how to convert from the 5-byte file timestamp to the
standard seconds-since-1970 4-byte Unix one?  I've tried the following:

  Take the exec.address (equivalent to time/256)
  Shift left once (equivalent to time/128, roughly the time in seconds)
  If the high bit of the remaining time byte is set, add one
		  (compensate for individual seconds)
  Subtract the difference between the Archimedes and Unix epochs.

This is a quick and dirty way of dividing the 5-byte centisecond value to a
4-byte second one, and then adjusting for the difference in the epoch. The
only problem is this gives garbled time values.

Does anyone have any code to do this conversion?

Thanks in advance,
Peter.
--
    pgut1@cs.aukuni.ac.nz || peterg@kcbbs.gen.nz || peter@nacjack.gen.nz
			     (In order of preference)
Re: Archimedes <-> Unix timestamp conversion
#283
Author: I.D. Griffiths
Date: Fri, 09 Oct 1992 15:17
24 lines
1451 bytes
In article <1992Oct9.004808.4421@cs.aukuni.ac.nz>, pgut1@cs.aukuni.ac.nz
(Peter Gutmann) writes:
|> Does anyone know how to convert from the 5-byte file timestamp to the
|> standard seconds-since-1970 4-byte Unix one?

Yup, had to do that one this summer...

Find out how to offset things from 1970 in Acorn format.  Easily done thus:

temp$=TIME$
TIME$="...acorny type date for 1st jan 1970"
OS_Word thingy to read time
TIME$=temp$

This will give you a value to subtract from Acorn dates to get them relative to
1970.

Then, divide by 100.  OK, so this is not a fun thing to have to do particularly
in assembler, but it is the only way to do it properly.   Getting the time
roughly in seconds isn't particularly helpful.  It's relatively easy going in
the other direction.  (I had to write both routines this summer, but I suspect
the direction you wish to go in ended up being in the C bit...)

Ian Griffiths
Re: Archimedes <-> Unix timestamp conversion
#324
Author: Peter Gutmann
Date: Thu, 15 Oct 1992 02:07
27 lines
1705 bytes
In <1992Oct9.151738.20184@infodev.cam.ac.uk> idg10@cl.cam.ac.uk (I.D. Griffiths) writes:

>In article <1992Oct9.004808.4421@cs.aukuni.ac.nz>, pgut1@cs.aukuni.ac.nz
>(Peter Gutmann) writes:
>|> Does anyone know how to convert from the 5-byte file timestamp to the
>|> standard seconds-since-1970 4-byte Unix one?

>Yup, had to do that one this summer...

>Find out how to offset things from 1970 in Acorn format.  Easily done thus:
>[ stuff deleted ]
>This will give you a value to subtract from Acorn dates to get them relative to
>1970.
>Then, divide by 100.

The problem is - this *doesn't* work (or if it does it does a very good job
of seeming not to work :-).  What you've said is exactly what I did.  The
dates were completely wrong, and what's more the relationship between the
converted dates was nonlinear (I still haven't found out exactly what the
relationship is).  Email from someone else who's tried this indicates that
I'm not the only one who's had trouble with this.  Is there anyone out there
who has working C code to do the conversion from Unix <-> Acorn format?

Peter.
--
    pgut1@cs.aukuni.ac.nz || peterg@kcbbs.gen.nz || peter@nacjack.gen.nz
			   (In order of preference)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads