Help: GetSysTime
11 messages in this thread
Hi
Does someone know how to use the GetSysTime(*timeval) – Function,
I tried it but all I get is a 8000000B – SystemFailure. I used a correctly
initialized (I think) pointer to timval.
I tried to open the timer.device before but nothing changed!
I think there is an other strukture to be initialized before, but which
one?
Thanks for help
Olaf
from DUESSELDORF GERMANY via Autopilot
According to the autodocs, it is…
GetSysTime(struct timeval *);
You will have to open the timer.device. What do you mean when you say you tried
to open it, but 'nothing changed'?
-larry
Opening the timer.device I did as following:
err:=OpenDevice('timer.device',UNIT_VBLANK,timeReq,0)
where timeReq is a pointer to timerequest, which is not NIL 🙂 !
I get an err=0, so I think it opened!?
After doing that I get the SYSTEM FAILURE when calling:
GetSysTime(time) with time being a pointer to timeval!
(I'm programming in E, but that should be no problem.)
Thanks,
Olaf
Interesting! You might want to check to make sure the glue code is doing the
right thing. Since the call is like a library call, but is actually calling a
device, I am not at all sure what address gets called for the routine. Since
you do not get an address back as a return value, it must either be obtained
somewhere else, or called in a different manner.
Wish I could help more.
-larry
Hi Olaf,
I'm not an E but a C programmer but the principle should be the same.
A device is exactly the same as a library but not quite. 🙂
Opening a library with OpenLibrary() returns the library base address
which must be put in the correct named variable so the glue code works.
'GfxBase' for the graphics library for example.
The same must be done for a device so the program will find the correct
address to call. The OpenDevice() function doesn't return the base address
of the device (or library) but "hides" it in the IORequest (or timerequest
in this case) structure. If you look at the timerequest structure it
contains an IORequest struct which in turn contains the address of the
opened device. In C to initialize the timer functions you would write:
TimerBase = timeReq->tr_node.io_Device;
with TimerBase declared as a pointer to a device.
Hope this helps,
— Freddy
Opening the timer.device I did as following:
err:=OpenDevice('timer.device',UNIT_VBLANK,timeReq,0)
where timeReq is a pointer to timerequest, which is not NIL 🙂 !
I get an err=0, so I think it opened!?
After doing that I get the SYSTEM FAILURE when calling:
GetSysTime(time) with time being a pointer to timeval!
(I'm programming in E, but that should be no problem.)
Thanks,
Olaf
Olaf,
to use GetSysTime(), you have to set the (global) timer device base adress
variable to point to the timer device base, after you opened timer.device
with (struct timrequest *)TimerIO:
TimerBase = (struct Library *) TimerIO->tr_node.io_Device;
Else you sure will watch the Indian meditating <g>.
– wkc – … via AP from Hamburg, Germany
Even though I was not the one asking, I thank you for posting the secret of
GetSysTime. Nowhere in the autodocs (at least the ones I have) do they mention
TimerBase or how to get it.
-larry
Larry,
thats's right, in the timer.doc file of Autodocs_3.1, there is no clue to
TimerBase.
But you may read all about it in the RKM "Devices", 3rd edition, Page 289.
– wkc – … via AP from Hamburg, Germany
Ahh.. .thanks for the additional pointer!
-larry
Werner,
thanks for the info (the asking one was me).
Olaf