On Thu, 23.10.14 21:24, Łukasz Stelmach (stl...@poczta.fm) wrote: > +int main(int argc, char *argv[]) { > + struct timex tbuf; > + int r; > + > + memset(&tbuf, 0, sizeof(tbuf));
Please initialize this with "= {}" while declaring, instead of using memset() here. > + r = adjtimex(&tbuf); > + > + while (r != TIME_OK) { This check looks wrong. Should check for tbuf.status & STA_UNSYNC, no? Also, we already have the ntp_synced() call for doing this. > + sleep(1); > + /* Unfortunately there seem to be no other way than > + polling to get this information. */ > + memset(&tbuf, 0, sizeof(tbuf)); In this case, use zero(), it's nicer, simpler and less error prone. > + r = adjtimex(&tbuf); > + } Implementing this with a sleep loop is really ugly. Can't we at least calculate the expected sync time from the data returned by adjtimex()? The same way as network-wait-online has a timeout this tool should probably have one too. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel