On 24.10.2014 00:28, Lennart Poettering wrote: > 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.
Indeed. I can replace most of the code here with ntp_synced() leaving an "if" with a break and the sleep(); >> + 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()? I don't know how to do it exactly (yet). But my guess is that when the system starts the information you refer are not good enough to predict anything? > The same way as network-wait-online has a timeout this tool should > probably have one too. If the timeout is reached the tool exits with a non-zero code. Right? That makes sense. Is three minutes OK? Give me a few more evenings to prepare the niceties others have requested. -- Było mi bardzo miło. Twoje oczy lubią mnie >Łukasz< i to mnie zgubi (c)SNL REKLAMA: http://ars-fabrica.eu/ sklep z rękodziełem
signature.asc
Description: OpenPGP digital signature
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel