[comp.sys.atari.st.tech] Reading the timer

alex@hpgnd.grenoble.hp.com (Alexis MERMET-GRANDFILLES) (12/10/90)

Hello there,

1)
	Does anybody know if there is a way ( should I say official ? )
	to read the system time of the 520STE that will give a result
	more precise than 2 seconds intervals.

	The Bios or Xbios call GetTime() only returns hours,minutes, and
	seconds divided by 2 ( ie from 0 to 30 ).

	I need something much more precise than that. Any idea?

2)
	What Xbtimer() xbios call is supposed to do ?


Thanks,

alex.

stefan@hpbbi4.BBN.HP.COM (#Stefan Bachert) (12/12/90)

/ hpbbi4:comp.sys.atari.st.tech / alex@hpgnd.grenoble.hp.com (Alexis MERMET-GRANDFILLES) / 10:54 am  Dec 10, 1990 /
> 
> 1)
> 	Does anybody know if there is a way ( should I say official ? )
>	to read the system time of the 520STE that will give a result
>	more precise than 2 seconds intervals.
>
>	The Bios or Xbios call GetTime() only returns hours,minutes, and
>	seconds divided by 2 ( ie from 0 to 30 ).
>
>	I need something much more precise than that. Any idea?

	No, there is no more precise date/timer which return
	hour,minutes,seconds.
	But you can the 200Hz Timer (=5ms) to measure small
	durations. There is a long value at address 1210 which
	is being incremented 200 times per second since system boot.
	(counting 5ms ticks). You must be in super mode to read
	this value.

	Maybe this will help you

	Stefan

apratt@atari.UUCP (Allan Pratt) (12/15/90)

alex@hpgnd.grenoble.hp.com (Alexis MERMET-GRANDFILLES) writes:
>	Does anybody know if there is a way ( should I say official ? )
>	to read the system time of the 520STE that will give a result
>	more precise than 2 seconds intervals.

There is a system variable that holds the time since the system was
booted, in 1/200ths of a second.  For measuring time spans, this works,
but you still can't get real time-of-day any more precisely than two
seconds.

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt

rosenkra@convex.com (William Rosencranz) (12/15/90)

In article <17750001@hpgnd.grenoble.hp.com> alex@hpgnd.grenoble.hp.com (Alexis MERMET-GRANDFILLES) writes:
>Hello there,
>
>1)
>	Does anybody know if there is a way ( should I say official ? )
>	to read the system time of the 520STE that will give a result
>	more precise than 2 seconds intervals.
>
>	The Bios or Xbios call GetTime() only returns hours,minutes, and
>	seconds divided by 2 ( ie from 0 to 30 ).
>
>	I need something much more precise than that. Any idea?

i wrote a gettimeofday(2) call which did the Gettime/Getdate, but also
gets the current value of the 200 Hz timer (just a system variable, long
at 0x4bc, access in Super mode). that gets u down to 5 ms which i then
use to get the second and stuff the rest in the tv_usec field of the
struct timeval (sys/time.h).

if u can't figure it out, i can send it to you...

-bill
rosenkra@convex.com

--
Bill Rosenkranz            |UUCP: {uunet,texsun}!convex!c1yankee!rosenkra
Convex Computer Corp.      |ARPA: rosenkra%c1yankee@convex.com

jpexg@rice-chex.ai.mit.edu (John Purbrick) (12/18/90)

In article <2783@atari.UUCP> apratt@atari.UUCP (Allan Pratt) writes:
>
>There is a system variable that holds the time since the system was
>booted, in 1/200ths of a second.  For measuring time spans, this works,
>but you still can't get real time-of-day any more precisely than two
>seconds.
>

Well--you could keep reading the seconds clock until it changes (thus giving
a fix for the end of a second) and store the contents of the 200ths-of-a-
second counter (or the 60ths/70ths, if you prefer it) at that moment. Then 
calculate the remainder when the difference between the count "now" and "then"
is divided by 200 | 70 | 60. This gives the number of time quanta since the 
last increment of the seconds clock.

John Purbrick

crichmon@digi.lonestar.org (Charles Richmond) (12/24/90)

The time of day is read by TOS from the keyboard processor.  I believe that
the time is packed into a single 32 bit word to match the way MS-DOS handles
the time stamp for files.

It is possible to get the time of day from the keyboard to the nearest
second.  This requires patching some interrupt vector and writing a
routine to send the time request packet to the keyboard and receive the
time packet.  Pages 67 through 84 in the book Atari ST Internals (from
Abacus Software) details the interface with the ST keyboard.  It seems I
read somewhere that the keyboard processor keeps time to milliseconds, but
cannot find it now.

Hope this helps.