--- src/timesync/timesync-wait.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/timesync/timesync-wait.c
I am afraid TFD_TIMER_CANCEL_ON_SET doesn't help much here. You can watch for time changes but it is not the moment adjtimex() starts to return TIME_OK and STA_UNSYNC flag unset. Where would you like this to be patched in? diff --git a/src/timesync/timesync-wait.c b/src/timesync/timesync-wait.c new file mode 100644 index 0000000..9648b09 --- /dev/null +++ b/src/timesync/timesync-wait.c @@ -0,0 +1,43 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2014 Łukasz Stelmach + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <string.h> +#include <sys/timex.h> +#include <unistd.h> +#include <stdio.h> + +int main(int argc, char *argv[]) { + struct timex tbuf; + int r; + + memset(&tbuf, 0, sizeof(tbuf)); + r = adjtimex(&tbuf); + + while (r != TIME_OK) { + sleep(1); + /* Unfortunately there seem to be no other way than + polling to get this information. */ + memset(&tbuf, 0, sizeof(tbuf)); + r = adjtimex(&tbuf); + } + + return 0; +} -- 2.0.4 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel