CompuServe Thread

Help: GetSysTime

11 messages in this thread
#40885From: Olaf MonienMay 6, 1994 11:30 AM
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
#40896From: John DraperMay 8, 1994 1:58 AM
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
#40913From: Olaf MonienMay 9, 1994 3:54 PM
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
#40919From: John DraperMay 10, 1994 1:11 AM
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
#40958From: Freddy PotargentMay 11, 1994 4:06 PM
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
#40983From: Olaf MonienMay 13, 1994 2:24 AM
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
#40998From: Werner KazmierzakMay 14, 1994 1:35 AM
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
#41018From: John DraperMay 15, 1994 11:21 AM
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
#41020From: Werner KazmierzakMay 15, 1994 1:21 PM
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
#41036From: John DraperMay 15, 1994 11:19 PM
Ahh.. .thanks for the additional pointer! -larry
#41074From: Olaf MonienMay 18, 1994 4:35 PM
Werner, thanks for the info (the asking one was me). Olaf