Whonix/sdwdate — pull request #3 by AvdN (2014-12-01 19:41:34+00:00)
Title: initial implementation of sclockadj2 using adjtimex syscall

initial implementation with and executable and some supporting modules (that should go in /usr/lib/pymodules/python2.7/sdwdate/)

sclockadj sets the interface to PLL and NANO mode. If you run in NANO mode and assume you provide µsec values you're in for a long wait) That is why there is a status mode for the program, so you can check.

sclocadj2 status [--verbose/-v][--quiet/-q][--set]
The other mode is to set the offset and allows values up to 0.5 sec (500000000 nanoseconds) in non-wait mode and more when specifiying ``--wait`` (which then loops through multiple calls to adjtimex and waits for the kernel to revert the offset to 0.

usage: sclockadj2 offset [-h] [--constant CONSTANT] [--verbose] [--quiet]
[--debug] [--wait]
nanoseconds

positional arguments:
nanoseconds Nanoseconds to add (substract if negative)

optional arguments:
-h, --help show this help message and exit
--constant CONSTANT 0 -> fastest autoadjusted for nano/µ sec (default no
adjustment)
--verbose, -v increase verbosity level
--quiet, -q decrease verbosity level
--debug, -D Debug messages. Don't change date
--wait wait for offset to return to 0

If sclockadj2 is not waiting then a second invocation resets any possible offsets still being processed by the kernel