[BRLTTY] getimeofday and rdate?

Samuel Thibault samuel.thibault at ens-lyon.org
Sun Sep 9 15:13:23 EDT 2007


Hi,

Mario Lang, le Sun 09 Sep 2007 20:51:54 +0200, a écrit :
> When I run "rdate" to resync my computers clock with some internet
> time server, it can happen that brltty stops to interact with my display for
> a certain period of time.

Unfortunately, this is a know problem with gettimeofday() and such
adjusting programs. For small clock shifts, rdate should use adjtime for
getting a smooth shift. For bigger shifts, gettimeofday() indeed gets
shifted.

What may be instead on systems that support it is
clock_gettime(CLOCK_MONOTONIC, &tp);
which is asserted to be monotonic, but that won't be usable on all
systems.  I don't know any function that would just return the time
starting from the boot of the computer.  I'd say brltty should hence
have "current" and "shift" variables, current storing the last
gettimeofday, and when we notice that gettimeofday becomes less than
current, increase shift. Then we can use (gettimeofday + shift) which
is monotonic.

Samuel


More information about the BRLTTY mailing list