Re: Callback on clock

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 11 Mar 97 06:33:05 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I created a simple form with clock on it. I thought that it would be
> nice if I could set system clock with callback attached to clock on my
> form. When I tried to do so, there was no response. There is a few
> questions I don't know and I think it could be interesting for all.

I'm not sure I understand the question completely but if you mean to
make a call from an XForms Clock callback to set the system clock
through adjtime(2) or settimeofday(2) then even if you could do it
there would be no point since I'm pretty sure the XForms Clock object
gets its time from time(3) -- in other words, the system's clock.

The XForms Clock is only reporting to you its notion of what the
system's time of day is, thus using it to set the system's time of day
is somewhat pointless -- in fact if you did succeed in doing so you'd
no doubt degrade the accuracy of the system clock since the round trip
between querying the time and setting it would introduce a soon
noticable delay.

If you perhaps mean using some sort of point and click interface to
move the hands of the XForms Clock and thereby change the system's
time of day, then you might be able to do this by setting a pre- or
post-handler and interact with the Clock that way. Offhand I don't
know if it will work but you could give that a try. Otherwise, the
manual specifically says "No interaction takes place with clocks."
They're read-only objects.

> First, is there some limitations on setting system clock while running
> X?

No, but you probably need to refer an external time base of some sort,
such as a WWV (or other national/international time standard)
receiver. The program also has to be setuid root, since only root is
allowed to change the system clock.

> Finaly, what should I add to make it work properly?

I'm afraid this may be a situation of "you can't get there from here."

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/